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

Recommended Answers

All 2 Replies

anyone can help me ?

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.

commented: Perfect & awesome +8
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.