[RESOLVED] Syntax error in UPDATE statement.
Hi ALL
I have an UPDATE query which gives me a syntax error in the Cmd. .ExecuteNonQuery() line.
I Have checked that the connection, table names, and data types are correct.
I Just can't put my finger on whats causing the error.
Hope some one can help me.
Here is the code
Thank you.
Code:
Public Class EditServices
Private ServiceId As Integer
Private quantidade As Integer
Public Property SetID As Integer
Get
Return ServiceId
End Get
Set(value As Integer)
ServiceId = value
End Set
End Property
Public Property Qunty As Integer
Get
Return quantidade
End Get
Set(value As Integer)
quantidade = value
End Set
End Property
Public Sub Updateservices(ByVal taxa As Decimal, ByVal subtotal As Decimal)
Try
Dim query As String = "UPDATE JobEntries_tbl SET [Itemquantity]=@qnty, [Taxes]=@taxs, [SubTotal]=@subTotl, WHERE [JobEntryID]=@ID"
Dim DBCon As New Connection
DBCon.FilePath = "C:\CFI\filepath.txt"
DBCon.connect()
DBCon.con.Open()
Dim cmd As New OleDb.OleDbCommand(query, DBCon.con)
With cmd
.CommandType = CommandType.Text
.CommandText = query
.Parameters.AddWithValue("@qnty", quantidade)
.Parameters.AddWithValue("@taxs", taxa)
.Parameters.AddWithValue("@subTotl", subtotal)
.Parameters.AddWithValue("@ID", ServiceId)
.ExecuteNonQuery()
End With
DBCon.con.Close()
Catch ex As Exception
MsgBox("EditServices_Updateservices: " & ex.Message)
End Try
End Sub
End Class
Re: Syntax error in UPDATE statement.
You have an extra comma in there.
Re: Syntax error in UPDATE statement.
Wow:
Thanks John for your reply.
I Should look more carefully next time.