我找遍了整个地方,我找不到答案。
这是我在使用 ColdFusion 和 MsSQL 时遇到的错误
Error Executing Database Query.
[Macromedia][SQLServer JDBC Driver][SQLServer]Conversion failed when converting date and/or time from character string.
The error occurred in SQL
INSERT INTO Requests (
RequestName,
RequestEmail,
RequestPhone,
RequestType,
RequestSiteSection,
RequestDue,
RequestUrgent,
RequestTitle,
RequestURL,
RequestMessage,
Attachment1,
Attachment2,
Attachment3,
Attachment4,
Attachment5,
RequestCreated,
RequestModified,
RequestPriority,
RequestAssignedTo,
RequestStatus
)
VALUES (
'',
'Joshua >Davis',
'onebigcelt@gmail.com',
'8046789',
'Correction',
'Natural Heritage',
'09/11/2013',
'This is the Title of the REQUEST!',
'http://www.dcr.virginia.com',
'rewas',
'/opt/coldfusion8/runtime/servers/coldfusion/SERVER-INF/temp/wwwroot-tmp/neotmp47128.tmp',
'',
'',
'',
'',
(param 1),
(param 2),
'0',
'Webmaster',
'Pending'
)
每个参数是cfqueryparam cfsqltype='CF_SQL_timestamp' value='#CreateODBCDateTime(now())#'
当我尝试使用以下任何一种插入时出现此错误
- cfqueryparam cfsqltype='CF_SQL_timestamp' value='#CreateODBCDateTime(now())#'
- 现在()
- CreateODBCDateTime(now())
- SQL 获取日期()
- 其他变体
我尝试将时间和日期连接在一起,转换并转换为 datetime ,格式化日期和时间,但没有运气我被卡住了。
我感谢您的帮助。
这是查询
INSERT INTO Requests (
RequestName,
RequestEmail,
RequestPhone,
RequestType,
RequestSiteSection,
RequestDue,
RequestUrgent,
RequestTitle,
RequestURL,
RequestMessage,
Attachment1,
Attachment2,
Attachment3,
Attachment4,
Attachment5,
RequestCreated,
RequestModified,
RequestPriority,
RequestAssignedTo,
RequestStatus
)
VALUES(
'<cfif IsDefined('form.requestUrgent')>#form.requestUrgent#</cfif>',
'#form.requestName#',
'#form.requestEmail#',
'#form.requestPhone#',
'#form.requestType#',
'#form.requestSection#',
'#form.requestDueDate#',
'#form.requestTitle#',
'#form.requestURL#',
'#form.requestMessage#',
'#form.attachment1#',
'#form.attachment2#',
'#form.attachment3#',
'#form.attachment4#',
'#form.attachment5#',
getdate(),
getdate(),
'0',
'Webmaster',
'Pending'
)
您可以getDate()
使用上述任何选项#var#
转换强制转换、参数等