Hello everyone. I was wondering if it was possible to do a cfinsert inside
a cfscript.
What I am trying to do, is have the user enter two dates, then figure out
the dates in between them, and insert all those dates into a database.
Here's what I have so far:
<cfscript>
//Get the difference between the dates
local.difference = Abs(DateDiff(d, #form.eventStartDate#,
#form.eventEndDate#)); //Get the difference between the dates
local.StopLoop = local.difference + 1; //Find the stop point for the loop.
//Use the date difference to generate the date in the span between the
starting and ending date
for (diff = 1; diff less than local.StopLoop; diff = diff + 1)
local.#diff# = DateAdd(d, #diff#, date); //Give each day
between the
first and last date its own variable
</cfscript>
<cfquery name="qcfAddEventDates" datasource="FSLibrary_Dev">
INSERT INTO dbo.tbl_EP_EventDateTime(EventID, EventDate)
VALUES (#qcfGetNewestID.LastRecord#, )
</cfquery>
I would like to figure out the date, and ut it into the database in one fell
swoop, if that's possible. If not, Can I put each date into a list, then
loop over that?
Thanks,
Chris Martin
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists