MySQL Forums
Forum List  »  Stored Procedures

OUT Param / VBScript / ODBC
Posted by: Geoff Lane
Date: January 21, 2009 10:28AM

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

Options: ReplyQuote


Subject
Views
Written By
Posted
OUT Param / VBScript / ODBC
5265
January 21, 2009 10:28AM
1868
January 21, 2009 02:42PM
2443
January 21, 2009 05:02PM
2445
January 21, 2009 07:03PM
1778
January 22, 2009 01:46AM
1760
January 22, 2009 05:37AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.