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

strange INSERT INTO problem

Status
Not open for further replies.

Fstop

Programmer
Jan 17, 2001
4
US
Hey all -- I have this deal with a Standard Insert into
that does not work -- 100's of others work just fine for some reason this one does not ...I have re-created the table , DB, and query , the page everything ,checked reserved words, deleted fields and variables one at a time.
NO LUCK ...perhaps the good people here can shed some light on it. I CAN do a CFINSERT and works fine.....
here is the code


<CFQUERY name=&quot;job&quot; Datasource=&quot;Urban&quot;>
Insert Into Jobs (Title, Desc, Office, POC, Reqs, dte)
Values ('#Title#', '#Desc#', '#Office#', '#POC#', '#Reqs#', '#dte#')
</cfquery>



I keep getting ......................................... ODBC Error Code = 37000 (Syntax error or access violation)
[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement


What gives?
 
Hi FStop

If dte is a datetime field I know that SQL Server doesn't like '' around the value. Don't know which database you are using, but you might want to try using #dte#
instead of '#dte#'. Although it seems strange that CFINSERT would work under the same conditions.

Cheers,
xor

 
Hey Fstop,

I believe the problem is with your field desc which is a reserved word in Access. Try this:

Insert Into Jobs (Title, &quot;Desc&quot;, Of

I just had to do this a few days ago on an Access project where a field was called &quot;desc&quot;. If you surround field names (not values) with double quotes, the odbc driver will treat it as a field name and not as a reserved word.

Let me know if this isn't it.
GJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top