ASP Classic参数错误

时间:2014-11-26 12:55:01

标签: asp-classic adodb

我正在尝试对数据库运行参数化查询:

set cmd = Server.CreateObject("ADODB.Command")

QUERY = ""
QUERY = QUERY & "INSERT INTO ORGBHVEmergencydocument(documentDate, version, LocationID, note, title) "
QUERY = QUERY & "VALUES (?, ?, ?, ?, ?) "

cmd.ActiveConnection = objCon
cmd.CommandText = QUERY

set paramDate = cmd.CreateParameter("@datum", adDate, adParamInput, , datum)
set paramVersion = cmd.CreateParameter("@version", adVarChar, adParamInput, 10, version)
set paramLocation = cmd.CreateParameter("@Location", adInteger, adParamInput, , locationID)
set paramNote = cmd.CreateParameter("@note", adVarChar, adParamInput, , note)
set paramTitle = cmd.CreateParameter("@title", adVarChar, adParamInput, 255, title)

cmd.Parameters.Append paramDate    
cmd.Parameters.Append paramVersion    
cmd.Parameters.Append paramLocation    
cmd.Parameters.Append paramNote    
cmd.Parameters.Append paramTitle   

cmd.execute

当我执行此操作时,我收到错误: ADODB.Command错误'800a0bb9' 参数类型错误,超出可接受的范围,或彼此冲突。

指向该行:'set paramDate'

变量datum在开头设置为:cDate(documentdate),在数据库中documentDate是Datetime。那么这里出了什么问题?

0 个答案:

没有答案