【问题标题】:SQL db type of comment and classic ASP stored procedureSQL db 类型的注释和经典的 ASP 存储过程
【发布时间】:2015-09-24 03:03:06
【问题描述】:

当我尝试使用经典 ASP 代码执行存储过程时出现此错误:

ADODB.Command error '800a0d5d'

Application uses a value of the wrong type for the current operation.

这是编译器抱怨的那一行:

cmdStoredProc.parameters.append cmdStoredProc.createparameter("@Comments",201,1,16,strComments)

@Comments 属于 sql db 类型“文本”。

存储过程需要这个参数:

@Comments text = null

我做了一些响应写入行来调试并确保应用程序到达上面的行,所以这个参数有问题。

在我的情况下,您认为为“文本”类型声明存储过程参数有什么错误吗?

【问题讨论】:

  • 可能是文本太长。见这里:stackoverflow.com/questions/8354859/…
  • 我在这里看不到 VB6 问题。首字母缩略词“SQL”不代表 Microsoft SQL Server。神奇的数字201adLongVarChar 但可能应该使用adLongVarWChar。神奇的数字1adParamInput。然而,这些似乎都不是问题。
  • @Bob77: adLongVarChar 是正确的,因为数据库类型只是Text,而不是NText
  • 仅供参考 经典 ASP 使用脚本语言,因为它们没有被编译,所以没有“编译器”,更多的是抱怨的“运行时”。

标签: vbscript asp-classic vb6


【解决方案1】:

已经在SQL Server上定义了存储过程...不需要附加参数,直接设置即可:

cmdStoredProc.parameters("@Comments") = strComments
Set rsTheResultingRS = cmdStoredProc.Execute

...假设这是唯一的参数。

至少,这是我当前运行的服务器调用 SP 的方式。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-02
    相关资源
    最近更新 更多