DataReader

P

patrick

newbie-question

i have a table with 2 rows and 4 columns. i'm using a datareader for
performance reason. now i would like to assign to a textfield a value from
this datareader, i.e

if value in record1/field1 = bla then
textfield.text = row1.field4
end if

how can i do this?
 
P

PeterKellner

patrick said:
newbie-question

i have a table with 2 rows and 4 columns. i'm using a datareader for
performance reason. now i would like to assign to a textfield a value from
this datareader, i.e

if value in record1/field1 = bla then
textfield.text = row1.field4
end if

how can i do this?

Here is some example code.
while (sqlDataReader.Read())

{

textfield.text = sqlDataReader.IsDBNull(0) ? string.empty :
sqlDataReader.GetString(0);

}
 

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
473,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top