Question : as400 stored procedure using classic ASP

i need to call an AS400 DB2 stored procedure from a classic ASP page.  
using the following:
     Dim termcode
     Dim chassisnumber
     Dim StrProc
     Dim strProcCMD
     Dim RST

      chassisnumber            = "APLZ330211"
      termcode                   = "GBLDEV"

     Set STRProc = Server.Createobject("adodb.connection")
     STRProc.open "test","gblodbc","odbcgbl"
     Set strProcCMD = server.createobject("adodb.command")
     Set strProcCMD.ActiveConnection = STRProc
     strProcCMD.CommandText = "call getOpenDvirByChassis(termcode, chassisnumber);"
      Set RST = strProcCMD.Execute

then i should be able to iterate thur the recordset.

i get the this error:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[IBM][Client Access Express ODBC Driver (32-bit)][DB2/400 SQL]SQL0104 - Token TERMCODE was not valid. Valid tokens: :.

what is wrong with the parameters.
I think i need to use a different method.

Answer : as400 stored procedure using classic ASP

you can't use
 strProcCMD.CommandText = "call getOpenDvirByChassis(termcode, chassisnumber);"

since termcode is a variable in your asp, which is unknown to db2
either use string concatenation to replace the variable name with the actual value or use parameter markers (?)
and pass the values through parameters
Random Solutions  
 
programming4us programming4us