Hello,
i really appreciate the help i just received on a related subject:
I've got a new question. From VBScript, how does one call a MySQL stored procedure and retrieve output params?
I created a MySQL stored procedure:
PROCEDURE sp_Test_Proc2(
OUT vOutID int,
OUT vOutID2 int)
BEGIN
set vOutID=5;
set vOutID2=25;
END
(i used phpMyIDE to do it.)
Here's my VBScript code:
dim adCmdStoredProc
adCmdStoredProc = 4
dim adInteger
adInteger = 3
dim adBigInt
adBigInt = 20
dim adVarchar
adVarchar = 200
dim adParamReturnValue
adParamReturnValue = 3
dim adParamInput
adParamInput = 1
dim adDBTimeStamp
adDBTimeStamp = 135
dim strConnection
strConnection = "DRIVER={MySQL ODBC 5.1 Driver}; SERVER=myHostingCompanysServer; PORT=3306;DATABASE=myMYSQLDB; USER=MyUser; PASSWORD=MyPass; OPTION=3;"
dim objCmd
set objCmd= Server.CreateObject("ADODB.Command")
objCmd.ActiveConnection = strConnection
objCmd.CommandText = "myMYSQLDB.sp_Test_Proc2"
objCmd.CommandType = adCmdStoredProc
objCmd.Parameters.Append objCmd.CreateParameter("vOutID", adInteger, adParamReturnValue, , 0)
objCmd.Parameters.Append objCmd.CreateParameter("vOutID2", adInteger, adParamReturnValue, , 0 )
'execute the command
objCmd.Execute
'retrieve the values
response.write (objCmd.Parameters.Item("@vOutID").Value)
response.write (objCmd.Parameters.Item("@vOutID2").Value)
set objCmd = nothing
... the error message I receive is:
"[MySQL][ODBC 5.1 Driver][mysqld-5.0.51-log]OUT or INOUT argument 1 for routine mbcrazy_MySQL.sp_Test_Proc2 is not a variable or NEW pseudo-variable in BEFORE trigger"
Does anyone know how to get those output parameters back into my VBScript?
thanks,
i really appreciate the help i just received on a related subject:
I've got a new question. From VBScript, how does one call a MySQL stored procedure and retrieve output params?
I created a MySQL stored procedure:
PROCEDURE sp_Test_Proc2(
OUT vOutID int,
OUT vOutID2 int)
BEGIN
set vOutID=5;
set vOutID2=25;
END
(i used phpMyIDE to do it.)
Here's my VBScript code:
dim adCmdStoredProc
adCmdStoredProc = 4
dim adInteger
adInteger = 3
dim adBigInt
adBigInt = 20
dim adVarchar
adVarchar = 200
dim adParamReturnValue
adParamReturnValue = 3
dim adParamInput
adParamInput = 1
dim adDBTimeStamp
adDBTimeStamp = 135
dim strConnection
strConnection = "DRIVER={MySQL ODBC 5.1 Driver}; SERVER=myHostingCompanysServer; PORT=3306;DATABASE=myMYSQLDB; USER=MyUser; PASSWORD=MyPass; OPTION=3;"
dim objCmd
set objCmd= Server.CreateObject("ADODB.Command")
objCmd.ActiveConnection = strConnection
objCmd.CommandText = "myMYSQLDB.sp_Test_Proc2"
objCmd.CommandType = adCmdStoredProc
objCmd.Parameters.Append objCmd.CreateParameter("vOutID", adInteger, adParamReturnValue, , 0)
objCmd.Parameters.Append objCmd.CreateParameter("vOutID2", adInteger, adParamReturnValue, , 0 )
'execute the command
objCmd.Execute
'retrieve the values
response.write (objCmd.Parameters.Item("@vOutID").Value)
response.write (objCmd.Parameters.Item("@vOutID2").Value)
set objCmd = nothing
... the error message I receive is:
"[MySQL][ODBC 5.1 Driver][mysqld-5.0.51-log]OUT or INOUT argument 1 for routine mbcrazy_MySQL.sp_Test_Proc2 is not a variable or NEW pseudo-variable in BEFORE trigger"
Does anyone know how to get those output parameters back into my VBScript?
thanks,