Re: fetching boolean value from sql query result

From: Daves (dbspam_at_simnet.is)
Date: 03/03/05


Date: Thu, 3 Mar 2005 21:57:27 -0000

thx this works 100%
But why does ADO make it so complex to use DataReader["fieldname"] for
fetching the field values? It is as if it wants me by default to get them by
DataReader(field number) but this field number could so easily change if the
sql query is changed and ... an error would be produced. Am I missing
something?

"Kai Brinkmann [MSFT]" <kaibrink@online.microsoft.com> wrote in message
news:uwNJmnDIFHA.2852@TK2MSFTNGP09.phx.gbl...
> Try
>
> ... = MyDataReader.GetBoolean(MyDataReader.GetOrdinal("IsLocked"));
>
> --
> Kai Brinkmann [MSFT]
>
> Please do not send e-mail directly to this alias. This alias is for
> newsgroup purposes only.
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
>
> "Daves" <dbspam@simnet.is> wrote in message
> news:OUuukdDIFHA.1476@TK2MSFTNGP09.phx.gbl...
>> trying to get a boolean value from DataReader (that is, result from a SQL
>> query);
>>
>> boolean MyBool = MyDataReader.GetBoolean(3);
>>
>> well it works using that number 3 but of course I would like to do
>> something like
>> ... = MyDataReader.GetBoolean["IsLocked"];
>>
>> since I don't always know the field number of the IsLocked field. Why is
>> this so complicated and what is the best solution??
>>
>
>



Relevant Pages

  • Re: FieldByRealName
    ... Hovewer I am not sure that this ... >> known by the alias. ... I take it the SQL query is not ... >> Ray Marron ...
    (borland.public.delphi.database.ado)
  • Re: See the structure of what I am pulling via DBI
    ... > sure how to see the arrayref. ... if you know the field name or its alias you can use $sth->fetchrow_hashref ... and you have access to the sql query ...
    (perl.beginners)
  • Re: SQL query: how can I hide a column in output?
    ... I've the following SQL query: ... Actually, I need the alias client_no for further processing, but I ... You are not required to show that column, but your SELECT clause needs to show at least one column. ... If you are writing your own application, you do not have to display the column's value in that application if you do not want to. ...
    (comp.databases.oracle.server)

Loading