This is my first time using VBScript with MySQL. For info, the "server" runs Windows XP Pro SP3 with the cut-down version of IIS. Installed are MySQL 5.1 with the 5.1 ODBC Driver.
I've created a test procedure that I want to insert a blank data row into a table and then return the primary key of that row to VBScript. At the MySQL CLI, I defined the procedure thus:
CREATE PROCEDURE MyProcTest (OUT MyID BIGINT)
BEGIN
INSERT INTO Test (comment) VALUES ('');
SET MyID = LAST_INSERT_ID();
END
In VBScript, I've declared a connection "conn" then:
Set cmd = Server.CreateObject("ADODB.Command")
With cmd
.ActiveConnection = conn
.CommandType = adCmdStoredProc
.CommandText = "MyProcTest"
.Parameters.Append .CreateParameter("MyID", adBigInt, adParamOutput, 20)
.Execute
End With
When the command is executed , I get this error:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[MySQL][ODBC 5.1 Driver][mysqld-5.1.30-community]OUT or INOUT argument 1 for routine bookingsdb.MyProcTest is not a variable or NEW pseudo-variable in BEFORE trigger
This code is pretty much how I did things successfully in VBScript with MS SQL.
Can someone tell me where I'm going wrong or suggest a better way to insert a blank record and retrieve the PK value from the new row?
TIA,
Geoff