Am getting problem with this update statement:
Here's the code:

Private Sub cmdUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdUpdate.Click
        Try
            Dim com As New OleDbCommand
            com.Connection = con
            com.CommandText = "Update Sales set CustomerId='" & txtCustomerId1.Text & "',WatchId='" & txtWatchId1.Text & _
            "',Dateofsales='" & txtDate.Text & "',Quantity='" & txtQuantity.Text & "',Priceperunit='" & txtprice1.Text & "',TotalPrice='" & txtTotal.Text & _
            "',TotalPriceInclVat='" & txttotalpriceinclvat1.Text & "'Where WatchID='" & txtSalesId.Text & "'"
            com.ExecuteNonQuery()
            MsgBox("Record Updated")
            Call populate()
        Catch
            MsgBox("Error")
        End Try
    End Sub

error saying (no value given for one or more required parameters)
please help
thanks

@manutd4file : error saying (no value given for one or more required parameters)

--- Compare columns names with your fields (columns) of database's table.

As suggested by Scott Knake, find what the final SQL is, copy that and paste in query analyzer to see if that by itself. Syntax error given there are more informative. Other thing he suggested is paramterize your query. Otherwise, data with single quote will bomb the query, worst yet, it is prone to security flaw (google SQL injection)

Try displaying the SQL as a Label in your form to see if some of the txt.Text is null.

This article has been dead for over six months. Start a new discussion instead.