Binding data to a text box

Discussion in 'ASP .Net' started by =?Utf-8?B?Y2hyaXM=?=, Jul 21, 2004.

  1. 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
     
    =?Utf-8?B?Y2hyaXM=?=, Jul 21, 2004
    #1
    1. Advertising

  2. 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" <> wrote in message
    news:...
    > 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
     
    Martin Marinov, Jul 21, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jordan
    Replies:
    2
    Views:
    2,547
    Jordan
    Feb 10, 2004
  2. Gnarlodious
    Replies:
    4
    Views:
    17,640
    elizas
    May 5, 2010
  3. Lloyd Sheen
    Replies:
    0
    Views:
    502
    Lloyd Sheen
    Apr 17, 2008
  4. David Wier
    Replies:
    0
    Views:
    556
    David Wier
    Apr 17, 2008
  5. FredBloggs012

    Text box data binding

    FredBloggs012, Jun 14, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    138
    Scott M.
    Jun 15, 2004
Loading...

Share This Page