update syntax error on SQL

theorus

New member
Joined
Aug 29, 2010
Messages
1
Programming Experience
Beginner
VB.NET:
        Update Button when Clicked

        Dim suppQuery As String = "SELECT [Supplier ID],[Company],[Last Name],[First Name],[Email Address],[Mobile Phone],[Office Phone],[Address],[City],[ZIP/Postal Code],[Notes] FROM [Suppliers]"
        Dim dsSupp As New DataSet
        Dim daSupp As New OleDbDataAdapter(suppQuery, cnPharma)
        Dim cbSupp As New OleDbCommandBuilder(daSupp)
 
        Try
 
            daSupp.Fill(dsSupp, "Suppliers")
 
            Dim rownum As Integer
            rownum = listSupplier.SelectedIndex
 
            With dsSupp.Tables("Suppliers")
                .Rows(rownum).Item("Company") = txtCompany.Text
                .Rows(rownum).Item("Last Name") = txtLastName.Text
                .Rows(rownum).Item("First Name") = txtFirstName.Text
                .Rows(rownum).Item("Email Address") = txtEmail.Text
                .Rows(rownum).Item("Mobile Phone") = txtMPhone.Text
                .Rows(rownum).Item("Office Phone") = txtOPhone.Text
                .Rows(rownum).Item("Address") = txtAddress.Text
                .Rows(rownum).Item("City") = txtCity.Text
                .Rows(rownum).Item("ZIP/Postal Code") = txtPostal.Text
            End With
            daSupp.Update(dsSupp, "Suppliers")


it errors on the da.Update line - syntax error on SQL statement
and by the way if it helps, the text fields are a product of datarowview. that is when you select an item on the listbox the details of that appears on the text fields. and my goal is i could edit those text fields and save them. thanks for the help
 
Last edited:
Back
Top