0

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

5
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by yorro
0

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

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

0

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)

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.