Re: fetching boolean value from sql query result
From: Daves (dbspam_at_simnet.is)
Date: 03/03/05
- Next message: MarkT [developmentor]: "RE: Override Equals ... AND Hashcode?"
- Previous message: Jon Skeet [C# MVP]: "Re: Override Equals ... AND Hashcode?"
- In reply to: Kai Brinkmann [MSFT]: "Re: fetching boolean value from sql query result"
- Next in thread: Daves: "Re: fetching boolean value from sql query result"
- Reply: Daves: "Re: fetching boolean value from sql query result"
- Messages sorted by: [ date ] [ thread ]
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??
>>
>
>
- Next message: MarkT [developmentor]: "RE: Override Equals ... AND Hashcode?"
- Previous message: Jon Skeet [C# MVP]: "Re: Override Equals ... AND Hashcode?"
- In reply to: Kai Brinkmann [MSFT]: "Re: fetching boolean value from sql query result"
- Next in thread: Daves: "Re: fetching boolean value from sql query result"
- Reply: Daves: "Re: fetching boolean value from sql query result"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|