Nowadays I am working on one of my assignments in vb.net. Assignment is about making a software that work like ATM.
I am facing problem in this query for the access database
error is syntax error but there is no error as far i know
I will appreciate if you can help
statement is
cmd = New OleDbCommand("INSERT INTO Transaction VALUES('" & WithDrawTxt.Text & "','" & AccountNo.ToString & "','" & dt.ToString & "')", cn)
i = cmd.ExecuteNonQuery
Table Transaction has fields Amount, Account_Number, Transaction_Date and last is Transaction#. All have field text except Transaction# which is auto number.
I have changed it to following statement too but its not working even then
cmd = New OleDbCommand("INSERT INTO Transaction(Amount,Account_Number,Transaction_date) VALUES('" & WithDrawTxt.Text & "','" & AccountNo.ToString & "','" & dt.ToString & "')", cn)
i = cmd.ExecuteNonQuery
Guest UserPosted Dec 18, 2008, 11:44 AM
Dim s as string = "INSERT INTO Transaction(Amount,Account_Number,Transaction_date) VALUES('" & WithDrawTxt.Text & "','" & AccountNo.ToString & "','" & dt.ToString & "')"
Ayesha HafeezPosted Dec 18, 2008, 10:55 AM
Thanx for your concern
but this answer is not solving my problem
Guest UserPosted Dec 17, 2008, 3:49 PM
INSERT INTO [Transaction]
"Transaction" is a reserved word, meaning that it can cause problems if you use it as the name of a table or field. By placing square brackets around it you're telling the database that it's the name of an object.