Link to home
Start Free TrialLog in
Avatar of tariqanis2001
tariqanis2001

asked on

Can't update database with SQL dataAdapter

Hi,
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:

DataAdapterCustomers.Update(DataSetCustomers)

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.
ASKER CERTIFIED SOLUTION
Avatar of Sancler
Sancler

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tariqanis2001
tariqanis2001

ASKER

Thank you