databinding a textbox in a webform

Discussion in 'ASP .Net' started by Nikerz Inc, Feb 14, 2004.

  1. Nikerz Inc

    Nikerz Inc Guest

    Hi there,

    I want to bind a text box to a column in my dataset and update changes vice
    versa. I'm having a rough time to do so any help or examples appreciated!!

    Dim sql As String = "SELECT * FROM Consumer WHERE Consumer.ConsumerID = " &
    CustomerID

    Dim updatesql As String = "Update set consumer.firstname = " & TextBox1.Text
    & " WHERE Consumer.ConsumerID = " & CustomerID

    Dim MyOleDbConn As New OleDbConnection(connstr)

    Dim myOleDbCmd As New OleDbCommand(sql, MyOleDbConn)

    Dim myadapter As New OleDbDataAdapter()



    Dim myds As New DataSet()

    Dim mytable As DataTable

    Dim myrow As DataRow

    myadapter.UpdateCommand = New OleDbCommand(updatesql, MyOleDbConn)

    myadapter.SelectCommand = New OleDbCommand(sql, MyOleDbConn)

    MyOleDbConn.Open()

    myadapter.Fill(myds, "Consumer")

    If myds.Tables(0).Rows.Count > 0 Then

    TextBox1.Text = myds.Tables(0).Rows(0).Item("FirstName")

    End If

    myrow("FirstName") = "test"

    myadapter.Update(myds, "Consumer")

    DataGrid1.DataSource = myds

    DataGrid1.DataBind()

    MyOleDbConn.Close()

    End Sub
     
    Nikerz Inc, Feb 14, 2004
    #1
    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. Hazzard
    Replies:
    2
    Views:
    590
    Yan-Hong Huang[MSFT]
    Jul 23, 2003
  2. Natty Gur
    Replies:
    0
    Views:
    498
    Natty Gur
    Jul 22, 2003
  3. jobs
    Replies:
    0
    Views:
    1,776
  4. AGSHAR
    Replies:
    1
    Views:
    611
    AGSHAR
    May 31, 2008
  5. Nikerz Inc

    .NET Databinding a textbox in a webform

    Nikerz Inc, Feb 13, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    169
    Ken Cox [Microsoft MVP]
    Feb 16, 2004
Loading...

Share This Page