Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert problem in Access 1

Status
Not open for further replies.

bowettwow

Programmer
Aug 1, 2002
57
GB
Please help - I am going crazy. I'm trying to insert a record into an Access database. I get the error:

Microsoft JET Database Engine (0x80040E14)
Syntax error in INSERT INTO statement.
/bowettsite/addMember.asp, line 54

Here is my SQL statement:

sqlStatement="INSERT INTO members(Username, Password, Name, Surname, Occupation, Email) VALUES('John', 'Hello', 'Johnny', 'Surname', 'Market Trader', 'someit@someit.someit');"

I can even copy the statement into Microsoft Query and it updates fine!
 
is the case of the column headings correct _________________________________________________________
for the best results to your questions: FAQ333-2924
01001111 01101110 01110000 01101110 01110100
onpnt2.gif
[/sub]
 
Name is a keyword... Try this...

sqlStatement="INSERT INTO members(Username, Password, [Name], Surname, Occupation, Email) VALUES('John', 'Hello', 'Johnny', 'Surname', 'Market Trader', 'someit@someit.someit');"

Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048
Tek-Tips Best Practices: FAQ183-3179
 
Ok - I have an update. It works if I switch my connection string from:

"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("db/Site.mdb") & ";"

To a DSN pointing at the database. Any ideas whats wrong with the connection string above.
 
I've heard that OLEDB is a little persnickety with Access. Did putting [Name] into your query fix it? Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048
Tek-Tips Best Practices: FAQ183-3179
 
Problem solved!!

Needed to be [password]

Cheers all.
 
there's nothing sparkingly wrong with thte connection string
the ";" is not needed but I do not think that makes a diff
eg:
"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("db/Site.mdb") _________________________________________________________
for the best results to your questions: FAQ333-2924
01001111 01101110 01110000 01101110 01110100
onpnt2.gif
[/sub]
 
Damn, I was close! Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048
Tek-Tips Best Practices: FAQ183-3179
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top