I am attempting to call a program from DB2 that accepts and returns a parm (AMSG). Very simple proof of concept (I am very new to both IBM and ADO)... the program should simply accept a character message and should return the same. I cannot for life of me figure out how to display the message I sent. Here is my code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD><TITLE> ADO Example 5 ... connection to as400 </TITLE></HEAD>
<BODY>
<!-- #include FILE="adovbs.inc" -->
<H1> HELLO WORLD!</H1>
<%
' set connection and recordset objects.
Dim adoCon
Dim adoRec
Set adoCon = Server.CreateObject("ADODB.Connection")
Set adoRec = Server.CreateObject("ADODB.Recordset")
Set adoCmd = Server.CreateObject("ADODB.Command")
strConn = "Provider=IBMDA400;User ID=AAAA;Password=AA;Data Source=PRIVATE;"
adoCon.Open strConn
adoCmd.CommandText = "CALL MARSTEST('YO')"
adoCmd.CommandType = adCmdText
set objParm = adoCmd.CreateParameter("AMSG",129,3,5)
adoCmd.Parameters.Append(objParm)
adoCmd.Parameters("AMSG") = "YOYO!"
set adoCmd.ActiveConnection = adoCon
Set adoRec = adoCmd.Execute
%>
<%
Set adoRec = Nothing
Set adoCon = Nothing
Response.Write("<br>HELLO!.")
%>
</BODY>
</HTML>
This code runs without error, but if I try to do a response.write or <%=whatever%> (i.e. Response.Write(adoRec.field(1).value), I get errors.
How do I expose the message ("YO", or "YOYO")?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD><TITLE> ADO Example 5 ... connection to as400 </TITLE></HEAD>
<BODY>
<!-- #include FILE="adovbs.inc" -->
<H1> HELLO WORLD!</H1>
<%
' set connection and recordset objects.
Dim adoCon
Dim adoRec
Set adoCon = Server.CreateObject("ADODB.Connection")
Set adoRec = Server.CreateObject("ADODB.Recordset")
Set adoCmd = Server.CreateObject("ADODB.Command")
strConn = "Provider=IBMDA400;User ID=AAAA;Password=AA;Data Source=PRIVATE;"
adoCon.Open strConn
adoCmd.CommandText = "CALL MARSTEST('YO')"
adoCmd.CommandType = adCmdText
set objParm = adoCmd.CreateParameter("AMSG",129,3,5)
adoCmd.Parameters.Append(objParm)
adoCmd.Parameters("AMSG") = "YOYO!"
set adoCmd.ActiveConnection = adoCon
Set adoRec = adoCmd.Execute
%>
<%
Set adoRec = Nothing
Set adoCon = Nothing
Response.Write("<br>HELLO!.")
%>
</BODY>
</HTML>
This code runs without error, but if I try to do a response.write or <%=whatever%> (i.e. Response.Write(adoRec.field(1).value), I get errors.
How do I expose the message ("YO", or "YOYO")?