Velocity Reviews

Velocity Reviews (
-   ASP .Net (
-   -   databinding a textbox in a webform (

Nikerz Inc 02-14-2004 08:54 AM

databinding a textbox in a webform
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 = " &

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)


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



End Sub

All times are GMT. The time now is 02:53 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.