I have binded a textbox to a column in a SQL Server 2005 Database, when i fill the dataset it displays the data, but when i click the save button it doesn not save the changes to the database. I used this same code to do a Datagridview and it worked fine. Does anyone know what im doing wrong? Please advise.
Thanks in advance.
Imports System.Data.SqlClient
Imports System.Data
Imports System.IO
Public Class Form1
Inherits System.Windows.Forms.Form
Private sqlconn As New SqlConnection("server=VSI-QA-03;Database=Database1SQL;integrated security=true")
Private da As New SqlDataAdapter("Select * From Info", sqlconn)
Private ds As New DataSet
Private cmb As New SqlCommandBuilder(da)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
da.Fill(ds, "Info")
txtFirstName.DataBindings.Add("Text", ds, "Info.FirstName")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
da.UpdateCommand = cmb.GetUpdateCommand
da.Update(ds.Tables("Info"))
End Sub
Private Sub txtID_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtID.TextChanged
End Sub
End Class