0

i've got code like this

 naglibog.CommandText = "UPDATE ptransaction " & _
                               " SET Quantityt = " & mm & _
                               ", Partial_totalt='" & jj & "'" & _
                                " WHERE Product_Codet =" & intProduct11_Code & "'" & "'AND  soldtime = '" & stime & "'"

                        naglibog.ExecuteNonQuery()

                        libogsya.CommandText = "UPDATE sold " & _
                           " SET quantity = " & mm & _
                           ", total_amount='" & jj & "'" & _
                            " WHERE product_code =" & intProduct11_Code & "'" & "' AND soldtime = '" & ddtime & "'"

                        libogsya.ExecuteNonQuery()

                        and the error occurs, 
                        Syntax error (missing operator) in query expression 'Product_Codet =3''AND  soldtime = '10:01 ''

                        how to fix this
2
Contributors
2
Replies
20
Views
5 Months
Discussion Span
Last Post by Reverend Jim
1

If I substitute some values and evaluate the first expression I get

UPDATE ptransaction  SET Quantityt = 23, Partial_totalt='24' WHERE Product_Codet =CODE''AND  soldtime = '2017-02-26 09:10:57'

You probably intended something like

UPDATE ptransaction  SET Quantityt = 23, Partial_totalt=24 WHERE Product_Codet ='CODE' AND  soldtime = '2017-02-26 09:10:57'

Check out the placement of your single quotes, especially after =CODE which is followed by two single quotes. You can avoid the hassle of composing queries by using parameterized queries.

Edited by Reverend Jim

Votes + Comments
Perfect & awesome
This question has already been answered. 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.