PROCEDURE的参数数量不正确

时间:2011-06-22 23:58:05

标签: mysql stored-procedures asp-classic

在很长一段时间内没有使用ASP,也从未处理过存储过程。我相信这是一年级的东西。

帮助将不胜感激。非常感谢你。

在MYSQL中有一个存储过程:

CREATE PROCEDURE `insert_custdetails`(IN p_Email VARCHAR(100), 
IN p_Fname VARCHAR(50), IN p_Lname VARCHAR(50), 
IN p_IP VARCHAR(40), IN p_OS VARCHAR(10), 
IN p_Browser VARCHAR(20), 
OUT ID INTEGER(11))
    NOT DETERMINISTIC
    CONTAINS SQL
    SQL SECURITY DEFINER
    COMMENT ''
BEGIN
INSERT INTO
  `customerdetails`(
  Email,
  Fname,
  Lname,
  IP,
  OS,
  Browser)
VALUES(
  p_Email,
  p_Fname,
  p_Lname,
  p_IP,
  p_OS,
  p_Browser);


Set ID = LAST_INSERT_ID();

END;

然后我在ASP中的代码:

SQL="CALL insert_custdetails ('1'," & _
    "'2'," & _
    "'3'," & _
    "'4'," & _
    "'5'," & _
    "'6');"
If Database(SQL) Then
    Response.Write Rs("ID")
End IfError is:

结果

-2147467259: 
[MySQL][ODBC 5.1 Driver][mysqld-5.1.34-community]Incorrect 
number of arguments for PROCEDURE mytable.insert_custdetails; 
expected 7, got 6  

我需要做什么才能宣布第7个参数?我怎么得到它?

1 个答案:

答案 0 :(得分:1)

http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.parameters.aspx

您应该使用SQLCommand和参数属性。链接显示示例。