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

why isnt this cfquery working? 1

Status
Not open for further replies.

leadman

Programmer
Joined
Jun 11, 2001
Messages
177
Location
US
I dont know why the following query:

===================beging query========================
<cfquery name=&quot;changes&quot; datasource=&quot;mydatabase&quot; dbtype=&quot;odbc&quot;>INSERT INTO mainpage (main_title,main_subtitle,main_text_one_title,main_text_one,main_text_two_title,main_text_two,main_email_link)
VALUES ('#form.titlefield#','#form.subtitlefield#','#form.textonetitlefield#','#form.textareaonefield#','#form.texttwotitlefield#','#form.textareatwofield#','#form.emailfield#')
WHERE m_frn_id=#localmid#
</cfquery>
===================end query========================

Is giving me the following error:

===================beging error========================
ODBC Error Code = 37000 (Syntax error or access violation)
[Microsoft][ODBC Microsoft Access Driver] Missing semicolon (;) at end of SQL statement.

The error occurred while processing an element with a general identifier of (CFQUERY), occupying document position (10:1) to (10:76).
===================end error========================

I tried the obvious (a semicolon at the end of the sql statement) but get the same error.
 
you hve got a where statement at the end of the query. do you want to add a new record to your database or do you want to update an existing one.

If you want to update an existing record then use the following syntax:

UPDATE TABLENAME
SET field1 = Form.Element
WHERE Primary_Key = Form.Variable

If you want to insert a new reord have what you have above but without the Where cause !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top