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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with SQL statement in ASP page 1

Status
Not open for further replies.

milage

Programmer
Jul 13, 2001
58
US
Hi, I was wondering if someone could help me. I don't understand why this sql statement works:

QueryCalendar = "INSERT INTO Calendar VALUES('" & CalendarTitle & "','" & CalendarDate & "','" & CalendarTime & "','" & CalendarBody & "','" & CalendarLocation & "')"

Where as this sql statement gives the error:

Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.

"INSERT INTO Calendar(Title, Date, Time, Body, Location) VALUES('" & CalendarTitle & "','" & CalendarDate & "','" & CalendarTime & "','" & CalendarBody & "','" & CalendarLocation & "')"

The Field names are identical to those in the Calendar table??

Cheers



 


milage,

DATE and TIME are reserved words so it might be trying to put the actual date and time in instead of using these as column names. Try using this:

([Title], [Date], [Time], [Body], [Location])


fengshui1998
 
Ah ha!

Don't you just love reserved words!!!

I didn't know about that sqaure brackets thing, I think that deserves a star
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top