Reputation: 1
This is what I am trying to do:
SQLStmt = String.Format( _
"insert into Details (OrderId, GSId, Qty, Each, LedgerId) values ({0}, {1}, {2}, {3}, {4})", _
OrderId, lblGSId.Text, Qty, txtEach.Text, lblLedger.Text)
'Debug.Write("UpdateSQLStmt=" & SQLStmt & vbCrLf)
Dim UpdateCommand As New SqlCeCommand(SQLStmt, Cnxn)
UpdateOK = UpdateCommand.ExecuteNonQuery()
Upvotes: 0
Views: 137
Reputation: 9822
Displaying the full query, after String.Format
call could help you to find the issue.
If you have any non-integer value in the query, make sure they are included in quotes. Also, make sure they are not empty.
For example, if LedgerId
is empty, your query is:
INSERT INTO Details (OrderId, GSId, Qty, Each, LedgerId) VALUES (42, 3, 5, 6, )
No value ^
As you can see, this is an invalid query, that could lead to the error message you are seeing.
Upvotes: 3