GetValue

G

Guest

Is there any way to use GetValue on a sqldatareader.Read() by specifying
column names instead of column numbers (or another method)?
 
W

William F. Robertson, Jr.

I think you are looking for...

SqlDataReader reader;
....
if ( reader.Read() )
object value = reader["Column1"];
object value2 = reader["Column2"];


or VB style ( I think)

dim value as object = reader("Column1")
dim value2 as object = reader("Column2")

HTH,

bill
 
G

Guest

perfick! thanks

William F. Robertson said:
I think you are looking for...

SqlDataReader reader;
....
if ( reader.Read() )
object value = reader["Column1"];
object value2 = reader["Column2"];


or VB style ( I think)

dim value as object = reader("Column1")
dim value2 as object = reader("Column2")

HTH,

bill

louise raisbeck said:
Is there any way to use GetValue on a sqldatareader.Read() by specifying
column names instead of column numbers (or another method)?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top