By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,065 Members | 1,560 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,065 IT Pros & Developers. It's quick & easy.

datareader question

P: n/a
i will select over 30 fieldsname from myTable.
If i use datareader, my way to get the result is (loop - the datareader)
and strResult = myReader.getstring(12) .
Can I use the itemname to get the result ??/
Thanks
Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Reader.Item("Column_name")

Or

Reader("Column_name")

Don't think there's any differance really.. depends on what you think its
easier to read I guess!

But When you use GetString.. you can't really use the columnnames and you
are stuck with typing the ColumnIndex.. and sometimes that's bad if you
would to change the number or order of columns in the database..

/Lars Netzel




"Agnes" <ag***@dynamictech.com.hk> skrev i meddelandet
news:OX***************@tk2msftngp13.phx.gbl...
i will select over 30 fieldsname from myTable.
If i use datareader, my way to get the result is (loop - the datareader)
and strResult = myReader.getstring(12) .
Can I use the itemname to get the result ??/
Thanks

Nov 20 '05 #2

P: n/a
Hi,

strResult = myReader.item("MyField").tostring

Ken
----------------------

"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:OX***************@tk2msftngp13.phx.gbl...
i will select over 30 fieldsname from myTable.
If i use datareader, my way to get the result is (loop - the datareader)
and strResult = myReader.getstring(12) .
Can I use the itemname to get the result ??/
Thanks

Nov 20 '05 #3

P: n/a
Hi Agnes,
i will select over 30 fieldsname from myTable.


In this kind of operations I create first a table of names and use that in a
loop or loops

I hope this helps?

Cor
Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.