here's my code

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
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

Recommended Answers

All 2 Replies

Just guessing you also need to define the Insert, Delete and Update commands for the OleDbDataAdapter before trying to use them.

oh ok, well i have tried a version without those SQL statements, i'll try it though thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.