0

here's my code

Dim sql As String = "INSERT INTO tbldailysales(date, totalprice)VALUES(@date, @totalprice)"
        cmd = New OleDbCommand(sql.ToString, con)
        cmd.Parameters.AddWithValue("@date", lblday.Text)
        cmd.Parameters.AddWithValue("@totalprice", lblstotal.Text)
        cmd.ExecuteNonQuery()
4
Contributors
4
Replies
14
Views
2 Years
Discussion Span
Last Post by jez9
0

The only thing I can see is that you're missing the final semi-colon (;) on the statement.
If it isn't that, can you provide the actual error message?

0

Agreed with Reverend Jim. Use Question Mark i.e. ? as a placeholder of a Parameter.
Your SQL Statement shoud be

Dim sql As String = "INSERT INTO tbldailysales(date, totalprice) VALUES(?, ?)"

But, what was the error report. Is your connection Object Opened. I did not find it in your code.

0

my connection is open. but i can add now, thanks for helping guys :)

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.