Help with SQL insert
Hi,
Brand new to CF - using CF9. Have SQL Server 2005 database. Only one table. Using CF for frontend. Do not know proper syntax to get INSERT to work. Keep getting "Element XXXXXX is undefined in FORM."
Database name is RAWH.
Columns for insert are:
- startdate
- enddate
- TypeHrs
- NoOfHours
- projects
- justification
Frontend has forms and fields which are:
Form Field (value)
firstDates startdate
firstDates enddate
typHrs TypeHrs
noHrs NoOfHours
none projects
none justification
Do not know how to code for INSERT - have this for now - which obviously does not work:
<cfquery name="RAWH" datasource="RAWH">
INSERT INTO RAWH
(startdate, enddate, TypeHrs, NoOfHours, projects, justification)
VALUES
(#Form.firstDates#, '#Form.startdate#', '#Form.enddate#', #Form.typHrs#, '#Form.TypeHrs#', #Form.noHrs#, '#Form.NoOfHours#')
</cfquery>
What am I doing wrong?
Get this:
Element FIRSTDATES is undefined in FORM. | |
| The error occurred in D:\ColdFusion9\wwwroot\RAWH1\RAWH1.cfm: line 5 | |
3 : (startdate, enddate, TypeHrs, NoOfHours, projects, justification) 4 : VALUES 5 : (#Form.firstDates#, '#Form.startdate#', '#Form.enddate#', #Form.typHrs#, '#Form.TypeHrs#', #Form.noHrs#, '#Form.NoOfHours#') 6 : </cfquery> 7 : | |
Really appreciate any help - thank you. BTW - datasource is in CF Admin.
John
| RAWH | Microsoft SQL Server | OK |
