JavaScript调用存储过程

时间:2010-12-16 14:30:03

标签: javascript mysql stored-procedures asp-classic

尝试从JavaScript调用存储过程:

<script type="text/javascript">
<!--#include file="Connections/sms.asp" -->

var UpdateCalls = Server.CreateObject("ADODB.Command");
UpdateCalls.ActiveConnection = MM_sms_STRING;
UpdateCalls.CommandText = "CALL sms.UpdateCalls()";
UpdateCalls.CommandType = 4;
UpdateCalls.CommandTimeout = 0;
UpdateCalls.Prepared = true;
UpdateCalls.Execute();

</script>

我测试了MySQL中的存储过程并且它正确执行,但不是来自JavaScript。 语法似乎是正确的。

有什么建议吗?

1 个答案:

答案 0 :(得分:2)

我明白了。

var UpdateCalls = Server.CreateObject("ADODB.Command");
UpdateCalls.ActiveConnection = MM_sms_STRING;
UpdateCalls.CommandText = "sms.UpdateCalls()";
UpdateCalls.CommandType = 4;
UpdateCalls.CommandTimeout = 0;
UpdateCalls.Prepared = true;
UpdateCalls.Execute();

不需要将CALL放在命令文本中,只需要使用sproc名称。

谢谢大家。

相关问题