Can't update database with SQL dataAdapter
Posted on 2006-06-06
Being new to database programming, I am trying my hand at using code (as opposed to dragging the graphical componants to the form).
I have a simple database on SQL server 2005 express, connected to a Windows form. When trying to update changes I make to to the fields on the form using the sqldataAdapter update command the changes are not committed to the databse.
I use the following line of code to perform the update:
The connection, dataAdapter and dataset were created using the following code:
Dim sConnectionString As String = _
"data source=TONI\SQLEXPRESS;" & "initial catalog=Murach;integrated security=SSPI;" & _
"persist security info=false;workstation id=TONI;packet size=4096"
Dim cnn As New SqlConnection(sConnectionString)
The Select statement
Dim sCustomersSelect = "Select * from Customers"
Dim DataAdapterCustomers As New SqlDataAdapter(sCustomersSelect, cnn)
Dim DataSetCustomers As New DataSet()
I think I need to configure my dataAdapter, but I have no idea how to do that in code. Please help.