Re: Fieldcount is not right.

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Greg Burns (greg_burns_at_DONT_SPAM_ME_hotmail.com)
Date: 12/23/04


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
>
>
>



Relevant Pages

  • Fieldcount is not right.
    ... The following sql statement is used to fill a datareader ... There are 6 fields requested from the database and when I execute this sql ... the one in column CarrierSiteName in the sql statement. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Fieldcount is not right.
    ... > The following sql statement is used to fill a datareader ... > There are 6 fields requested from the database and when I execute this sql ... the one in column CarrierSiteName in the sql statement. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Adding Images To MySQL
    ... you need the SQL text inside a string:: ... and you can execute it with:: ... That would be OK when you create the database for the first time. ... Note that execute has two arguments: first, a string with the sql statement text; second, a tuple containing the values. ...
    (comp.lang.python)
  • Re: Cascading Updates not working
    ... I'd love to have a tool that would generate and execute scripts for creating ... other SQL DBMS-related newsgroups, is to post SQL DLL statements (e.g. ... SQL statement at a time i.e. even if you gave someone a script there is ...
    (microsoft.public.access.tablesdbdesign)
  • Re: entering a query value to an INSERT INTO statement
    ... Try this sql statement in the Access Query Builder: ... more secure way to execute your queries by using ... look at the order in which the parameter markers occur in. ...
    (microsoft.public.inetserver.asp.db)