Re: Error reading recordset from DB2/AS400
- From: "Bob Barrows [MVP]" <reb01501@xxxxxxxxxxxxxxx>
- Date: Tue, 11 Sep 2007 10:36:07 -0400
ShaggyMoose wrote:
On Sep 10, 6:39 pm, "Stephen Howe" <stephenPOINThoweATtns-
globalPOINTcom> wrote:
Should not be. It could be the ADO code.
Could we see the code?
Sure. Here is the stored procedure on AS400:
CREATE PROCEDURE PR_TEST()
RESULT SETS 1
LANGUAGE SQL
BEGIN
DECLARE C1 CURSOR WITH RETURN FOR
SELECT * FROM QPGR/TMP_WRK;
OPEN C1;
END
And here is the VB6 code:
connString = "Driver={Client Access ODBC Driver (32-bit)};" & _
"System=xxx.xxx.xxx.xxx"
";Naming=1" & _
";DefaultLibraries=*USRLIBL"
Set adoConn = New ADODB.Connection
Call adoConn.Open(connString)
Set adoCmd = New ADODB.Command
With adoCmd
.ActiveConnection = adoConn
.CommandType = adCmdStoredProc
.CommandText = "PR_TEST"
End With
Set adoRecSet = New ADODB.Recordset
With adoRecSet
.CursorType = adOpenForwardOnly
.LockType = adLockOptimistic
.CursorLocation = adUseClient
Nothing to do with your problem, but the forward-only cursor type is
incompatible with a client-side cursor location. The only cursor type
supported by the ADO cursor library is static. If you want a
forward-only cursor, then you need to use a server-side cursor.
End WithIt's been awhile, but I seem to recall having to use the ODBC syntax for
calling stored procedures grom the AS400. Let me see if I can find an
example ...
With adoCmd
Set .ActiveConnection = adoConn
.CommandType = adCmdText
.CommandText = "{Call libraryname.PR_TEST()}"
End With
In fact, a server-side forward-only cursor is the default cursor, so
given that you want a forward-only cursor, you don't even need to create
an explicit Command object. Try this;
Set adorecSet= _
adoConn.Execute("{Call libraryname.PR_TEST()}", ,adCmdText)
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
.
- Follow-Ups:
- Re: Error reading recordset from DB2/AS400
- From: ShaggyMoose
- Re: Error reading recordset from DB2/AS400
- References:
- Error reading recordset from DB2/AS400
- From: ShaggyMoose
- Re: Error reading recordset from DB2/AS400
- From: Stephen Howe
- Re: Error reading recordset from DB2/AS400
- From: ShaggyMoose
- Error reading recordset from DB2/AS400
- Prev by Date: Re: Cursor problem for teired pricing
- Next by Date: Re: Error reading recordset from DB2/AS400
- Previous by thread: Re: Error reading recordset from DB2/AS400
- Next by thread: Re: Error reading recordset from DB2/AS400
- Index(es):
Relevant Pages
|
|