Topic
  • No replies
SystemAdmin
SystemAdmin
3105 Posts

Pinned topic Calling DB2 stored procedures from VB6

‏2003-03-21T17:01:51Z |
I'm calling a DB2 stored procedure from Visual Basic 6. However, I get
the following error message:

IBMCLI Driver CLI0118E Invalid SQL Syntax. SQLSTATE=37000

The stored procedure is properly set in DB2 and works very well. My
active connection in VB6 works also, since I can pull DB2 databases
using the data environment. But, again, calling a stored procedure
does not work.

I'm not passing anything in. However, the stored procedure is setup as
input/output in DB2 and returns the string 'hello ' Can anyone assist me
with the code that can make this work? I've been struggling with this
for quite a while and no one seems to know how to go about it.

Procedure Name: L83000PC in DB2 1 Parameter: "FIRST", adChar,
adParamInputOutput, 10
This is the code I'm using in VB6:

Sub GetStringFromDB2StoreProc()

Dim cmd As New ADODB.Command Dim param As New ADODB.Parameter Dim rs
As New ADODB.Recordset

'This is the name of the connection established in the
'DataEnvironment area of VB6. It connects successfully.
envFlexComm.ODBC_DB2E.Open

With cmd .CommandText = "{CALL L83000PC}" .CommandType =
adCmdStoredProc .ActiveConnection = envFlexComm.ODBC_DB2E

Set param = .CreateParameter("FIRST", adChar, adParamInputOutput,
10, " ") .Parameters.Append param rs.Open cmd

'txt is a textbox object on my form. txt = cmd("FIRST") End With

End Sub

--
posted via MFF : http://www.MainFrameForum.com - USENET Gateway