N
Nikerz Inc
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
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