Hi, Connie...
I usually write my insert queries like this: (except I *always* use
cfqueryparam's
as in the second example)...
<cfquery name="facultyfriday110708" datasource="cutla_Events"
insert into workshops
( firstname, lastname, department, email, lunch )
values
( '#form.firstname#', '#form.lastname#', '#form.department#',
'#form.email#', '#form.lunch#' )
</cfquery>
Even better:
<cfquery name="facultyfriday110708" datasource="cutla_events">
insert into workshops
(
firstname, lastname, department, email, lunch
)
values
(
<cfqueryparam cfsqltype = "cf_sql_varchar" value =
"#form.firstname#">,
<cfqueryparam cfsqltype = "cf_sql_varchar" value =
"#form.lastname#">,
<cfqueryparam cfsqltype = "cf_sql_varchar" value =
"#form.department#">,
<cfqueryparam cfsqltype = "cf_sql_varchar" value =
"#form.email#">,
<cfqueryparam cfsqltype = "cf_sql_varchar" value =
"#form.lunch#">
)
</cfquery>
The "cf_sql_varchar" part may change depending on your data types, but those
types seemed likely given the fieldnames.
Using the cfqueryparam statements will protect your from unwanted code
injection
in your form fields.
Let me know if this works for you... it's been a long time since I used
Access.
Rick
Connie Works wrote:
> HELP!!!!!!!!!!!!!
>
>
>
> I am trying to create an insert action page and an insert form with
> Access as the database. The datasource is cutla_Events, the table is
> workshops, and the query is facultyfriday110708. When I create the
> action page using cfinsert code, the program works fine. But when I use
> the cfquery coding, I get an HTTP500 error message "The website cannot
> display the page."
>
>
>
> What am I doing wrong? Below are the programs.
>
>
>
> Action Form:
>
>
>
> <!----------HTML form for online RSVP --------------->
>
> <form action="insert_action.cfm" method="post">
>
> <tr>
>
> <td>First Name: </td>
>
> <td><input type="text" name="firstname" size="60"
> maxlength="60" /></td>
>
> </tr>
>
> <tr>
>
> <td>Last Name:</td>
>
> <td><input type="text" name="lastname" size="60"
> maxlength="60" /></td>
>
> </tr>
>
> <tr>
>
> <td>Department:</td>
>
> <td><input type="text" name="department" size="60"
> maxlength="60" /></td>
>
> </tr>
>
> <tr>
>
> <td>E-mail Address:</td>
>
> <td><input type="text" name="email" size="60" maxlength="60"
> /></td>
>
> </tr>
>
> <tr> </tr>
>
> <tr>
>
> <td> </td>
>
> </tr>
>
> <tr>
>
> <td>I will be attending lunch:</td>
>
> <td><input type="checkbox" name="lunch" value="Yes" checked />
>
> Yes</td>
>
> </tr>
>
> <tr>
>
> <td> </td>
>
> </tr>
>
> <tr>
>
> <td></td>
>
> <td><input type="Submit" value="Submit" />
>
>
>
> <input type="reset" value="Clear Form" /></td>
>
> </tr>
>
> </form>
>
> </table>
>
>
>
>
>
> Insert Action Page:
>
> <!---- If the Lunch check box is clear, set the value of the Form.lunch
> to "No" ---->
>
> <cfif not isdefined ("Form.lunch")>
>
> <cfset Form.lunch = "No">
>
> </cfif>
>
>
>
> <!-------------Insert the new record---------------->
>
> <cfquery name="facultyfriday110708" datasource="cutla_Events">
>
> INSERT INTO workshops
>
> VALUES ('#Form.firstname#', '#Form.lastname#',
> '#Form.department#', '#Form.email#', '#Form.lunch#')
>
> </cfquery>
>
>
>
> <h1>Your RSVP has been added to the Faculty Friday Workshop. </h1>
>
> <cfoutput>#Form.firstname# #Form.lastname# thank you for your interest
> in the CUTLA Workshops.
>
> </cfoutput>
>
>
>
> Connie Works
> Business Systems Specialist
> Center for University Teaching, Learning, and Assessment
> Building 53/Room 207
> University of West Florida
> Pensacola, Florida 32514
> Telephone: 1-850-474-3080; FAX: 1-850-857-6331
> http://uwf.edu/cutla <http://uwf.edu/cutla>
>
>
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f
Archive:
http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4160
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15