This content has been marked as final. Show 4 replies
<cfprocparam type="In" cfsqltype="CF_SQL_TIMESTAMP" value="#DateFormat(form.txtInvoiceDate, 'dd-mm-yyyy')#" null="No">
The MS SQL server datatype DATETIME maps to CF_SQL_TIMESTAMP.
Removed CreateODBCDate function call
Corrected nested quotes in value attribute contents
The dbvarname attribute is no longer supported
You may also try a date format string 'yyyy-mm-dd' or 'mm-dd-yyyy' depending on the configuration of your SQL server
> <cfprocparam type="In" cfsqltype="CF_SQL_DateTime" dbvarname="InvoiceDate"
> value="#DateFormat(CreateODBCDate(form.txtInvoiceDate), "dd-mm-yyyy")#"
> but i am getting a varchar to datetime exeption
If it's after a date, why are you passing it a string? dateFormat() is for
converting a date into a string, which you'd only generally do when
outputting the date for a human.
Pass the DB a date.
PS: the dbvarname attribute of <cfprocparam> is not supported on most
recent versions of CF. This is probably not relevant to your situation,
but it's worth bearing in mind.
but i need to pass the format from a form field
so whats the best way to convert this to a date?