Re: Fieldcount is not right.
From: Greg Burns (greg_burns_at_DONT_SPAM_ME_hotmail.com)
Date: 12/23/04
- Next message: Larry Serflaten: "Re: "Basic Question""
- Previous message: Scott M.: "Re: "" and Nothing"
- In reply to: RD: "Fieldcount is not right."
- Next in thread: RD: "Re: Fieldcount is not right."
- Reply: RD: "Re: Fieldcount is not right."
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 23 Dec 2004 14:30:14 -0500
You say you changed the ntext column to nvarchar and STILL couldn't read the
column? That doesn't make any sense to me.
What is this part of your SQL statment?
ErreursDansEnregistrementRecu NOT LIKE '' " & " "
I can't make heads or tails out it. :^)
Greg
"RD" <nospam@nospam.net> wrote in message
news:eQ7YbJS6EHA.2032@tk2msftngp13.phx.gbl...
> 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
>
>
>
- Next message: Larry Serflaten: "Re: "Basic Question""
- Previous message: Scott M.: "Re: "" and Nothing"
- In reply to: RD: "Fieldcount is not right."
- Next in thread: RD: "Re: Fieldcount is not right."
- Reply: RD: "Re: Fieldcount is not right."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|