R
RD
The following sql statement is used to fill a datareader
Select dbo.SessionsFTP.DateEtHeure AS DateEtHeureRecue,
dbo.PigesRecuesViaFTP.IdentificationDuPoste as CarrierSiteID,
dbo.PigesRecuesViaFTP.NumeroReservoirDuFournisseur as TankId,
dbo.PigesRecuesViaFTP.CodeCarburant as CarrierProductCode,
dbo.PigesRecuesViaFTP.NomDuPoste as CarrierSiteName,
dbo.PigesRecuesViaFTP.ErreursDansEnregistrementRecu as Inconsistencies FROM
dbo.SessionsFTP INNER JOIN dbo.PigesRecuesViaFTP ON
dbo.SessionsFTP.IdSessionFtp = dbo.PigesRecuesViaFTP.IdSessionFtp where
dbo.PigesRecuesViaFTP.IdSessionFtp = 4457 AND ErreursDansEnregistrementRecu
NOT LIKE '' Order by ClientIdDuFournisseur,NumeroReservoirDuFournisseur
There are 6 fields requested from the database and when I execute this sql
statement in my SQL server query analyzer it does return the 6 columns
expected.
When I execute the following code in my vb.net program after filling the
datareader and executing a read command
(so I'm positioned on a record that has data in it, which I can check by
retrieving the contents of any of the columns up to index 4)
Dim myfieldCt as integer
myfieldct = dr.FieldCount
Myfieldct value returned is 5, it should be 6, the number of columns
returned is NOT zero based count.
If I execute a dr.getstring(4) I get the correct value expected from the
datareader, the one in column CarrierSiteName in the sql statement.
If I excute a dr.getstring(5) 'to get the value of the sixth column I get
an error "Index was outside the bounds of the array.". Indicating that the
datareader as not been correctly filled with all the fields requested by the
sql statement. Initially the last field was defined as an Ntext Field in the
database. I thought that might have had something to do with my problem, I
changed it to Nvarchar 255 for testing, same behaviour.
Its as if the last field does not get picked up by executing my sql
statement to fill the datareader. But I don't get any error message except
when I try to access the 6th field in any way.
Can anyone tell me what I need to do to be able to access that darn field. I
been f.... around for two days trying to get my finger on what's wrong here.
It sure starting to look as if there's a bug in the darn datareader class
that needs a workaround. Any help would be greatly appreciated.
Thanks,
Bob
Select dbo.SessionsFTP.DateEtHeure AS DateEtHeureRecue,
dbo.PigesRecuesViaFTP.IdentificationDuPoste as CarrierSiteID,
dbo.PigesRecuesViaFTP.NumeroReservoirDuFournisseur as TankId,
dbo.PigesRecuesViaFTP.CodeCarburant as CarrierProductCode,
dbo.PigesRecuesViaFTP.NomDuPoste as CarrierSiteName,
dbo.PigesRecuesViaFTP.ErreursDansEnregistrementRecu as Inconsistencies FROM
dbo.SessionsFTP INNER JOIN dbo.PigesRecuesViaFTP ON
dbo.SessionsFTP.IdSessionFtp = dbo.PigesRecuesViaFTP.IdSessionFtp where
dbo.PigesRecuesViaFTP.IdSessionFtp = 4457 AND ErreursDansEnregistrementRecu
NOT LIKE '' Order by ClientIdDuFournisseur,NumeroReservoirDuFournisseur
There are 6 fields requested from the database and when I execute this sql
statement in my SQL server query analyzer it does return the 6 columns
expected.
When I execute the following code in my vb.net program after filling the
datareader and executing a read command
(so I'm positioned on a record that has data in it, which I can check by
retrieving the contents of any of the columns up to index 4)
Dim myfieldCt as integer
myfieldct = dr.FieldCount
Myfieldct value returned is 5, it should be 6, the number of columns
returned is NOT zero based count.
If I execute a dr.getstring(4) I get the correct value expected from the
datareader, the one in column CarrierSiteName in the sql statement.
If I excute a dr.getstring(5) 'to get the value of the sixth column I get
an error "Index was outside the bounds of the array.". Indicating that the
datareader as not been correctly filled with all the fields requested by the
sql statement. Initially the last field was defined as an Ntext Field in the
database. I thought that might have had something to do with my problem, I
changed it to Nvarchar 255 for testing, same behaviour.
Its as if the last field does not get picked up by executing my sql
statement to fill the datareader. But I don't get any error message except
when I try to access the 6th field in any way.
Can anyone tell me what I need to do to be able to access that darn field. I
been f.... around for two days trying to get my finger on what's wrong here.
It sure starting to look as if there's a bug in the darn datareader class
that needs a workaround. Any help would be greatly appreciated.
Thanks,
Bob