Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
ASP and INSERT SQL statement
Basically when i do a response.write to my query string, then copy it and run it in my Access database as a SQL statement it works. However when i try and run it from my ASP page i get the error:
Microsoft JET Database Engine (0x80040E14)
Syntax error in INSERT INTO statement.
but the syntax can't have a error because it works when i run it on the database it works.
my code is:
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("database.mdb")
Set connection = Server.CreateObject("ADODB.Connection")
connection.Mode = 3 'allow writable
strQuery = "INSERT INTO Customer (username, password, Customer_FirstName, Customer_Surname, Address1, Address2, Town, Postcode, Tel, Email, SortCode, AccountNumber, PaymentTypeId) VALUES ( 'robbie', 'password', 'name', 'name1', 'add1', 'add2', 'town', 'post', 'tel', 'email', '111111', '33232', '1'); "
The only row missing is the primary key and that is of type auto number.
Thanks in advance.