Binding data to a text box

G

Guest

I have a question which I hope will have an easy answer. I created a webform with one textbox and a button. The button creates a connection to sqlserver, a data adapter, a dataset and querys the databse for a single returned value. All this works fine. Now how do I bind the returned value to the textbox on my form?

regards
 
M

Martin Marinov

Hi Chris,

Because of using DataSet to set the returned value from database in the
textbox you can do:

TextBox1.Text =
DataSet.Tables[0].Rows[index_of_row][index_of_column].ToString();

where
index_of_row is the index of the row if the rezult contains more than
one row
index_of column is the index or the name of the column from which you
want to get the value

Regards
Martin

chris said:
I have a question which I hope will have an easy answer. I created a
webform with one textbox and a button. The button creates a connection to
sqlserver, a data adapter, a dataset and querys the databse for a single
returned value. All this works fine. Now how do I bind the returned value to
the textbox on my form?
 

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,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top