Urgent Update statement

Hello every1 i got a problem to wirte my update statement.
Here's the code:
[code]Private Sub cmdUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdUpdate.Click

Dim com As New OleDbCommand
com.Connection = con
com.CommandText = "update Watches set WatchBrand='" & txtWatchBrand.Text & "',WatchModel='" & txtWatchModel.Text & _
"',Manufacturer='" & txtManufacturer.Text & "',CountryOfOrigin='" & txtCountryOfOrigin.Text & "',Type='" & _
cmbType.Text & "',DescriptionOfWatch='" & txtDescription.Text & _
",Price=" & txtPrice.Text & ",PriceInclVat=" & txtPriceInclVat.Text & " Where WatchID='" & cmbWatchId.Text
com.ExecuteNonQuery()
MsgBox("Record Updated")
Call populate()

End Sub[/code]

Please help as soon as possible, it very important, please help

Comments

  • seancampbellseancampbell Pennsylvania, USA
    [code]
    rivate Sub cmdUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdUpdate.Click

    Dim com As New OleDbCommand
    com.Connection = con
    com.CommandText = "update Watches set WatchBrand='" & txtWatchBrand.Text & "',WatchModel='" & txtWatchModel.Text & _
    "',Manufacturer='" & txtManufacturer.Text & "',CountryOfOrigin='" & txtCountryOfOrigin.Text & "',Type='" & _
    cmbType.Text & "',DescriptionOfWatch='" & txtDescription.Text & _
    ",Price=" & txtPrice.Text & ",PriceInclVat=" & txtPriceInclVat.Text & " Where WatchID='" & cmbWatchId.Text & "'"
    com.ExecuteNonQuery()
    MsgBox("Record Updated")
    Call populate()

    End Sub
    [/code]

    Added - & "'" - to the end of your Update line. that is most likely the issue you were having. You openned the string quote, but didn't close it...

    Let me know if that works,
    Sean C
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion