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!

access database and SQL insert into

Status
Not open for further replies.

mbdooly

Programmer
Joined
Jul 11, 2007
Messages
1
I had posted in another forum and since discovered that this may be a more appropriate forum. my problem is as follows- using access database, version 2002 I think- using cold fusion ver 5.0 and I want to insert a record into the db using sql statements- I do use this method, I have posted as sample code below, often and never have a syntax error get thrown, but today a different story. I have now run into a situation that will not respond properly- I get a syntax error using this sql :

INSERT INTO products
(familyid,name,price,desc,servingounces,nutritiongrams,container,calories,
totalfat,totalfatdaily,saturatedfat,saturatedfatdaily,transfat,
transfatdaily,sodium,sodiumdaily,carbohydrates,carbohydratedaily,sugars,
sugarsdaily,protein,proteindaily,nutrients)
VALUES
('#Form.familyid#','#form.name#','#form.price#','#form.desc#','#form.
servingounces#','#form.nutritiongrams#','#form.container#','#form.
calories#','#form.totalfat#','#form.totalfatdaily#','#form.saturatedfat#',
'#form.saturatedfatdaily#','#form.transfat#','#form.transfatdaily#',
'#form.sodium#','#form.sodiumdaily#','#form.carbohydrates#','#form.
carbohydratedaily#','#form.sugars#','#form.sugarsdaily#','#form.protein#',
'#form.proteindaily#','#form.nutrients#')

****************************************

Please bear in mind the table has columns that are defined as text, there is no numeric or date calulations required, just plain vanilla text!

Please help!
 
Remove the hash symbols.

Max Hugen
Australia
 
if you're trying to enter the values according to the controls on a form, then, you'll need to use the following syntax to reference the form's control from a query.

insert into tableName (col1)
values (forms!formName!controlName)

--------------------
Procrastinate Now!
 
Any chance that one inserted value contains a single quote ?
Max, FYI, I think that the hash symbols delimit a CF variable name.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV, so the CF SQL string may resolve to something different after CF processes it... ?

Max Hugen
Australia
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top