Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   databinding a textbox in a webform (http://www.velocityreviews.com/forums/t73056-databinding-a-textbox-in-a-webform.html)

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 = " &
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










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.