Solved
How to return a non-read only recordset from AS400.
Posted on 2002-06-24
I have the following versions:
AS400 – V5R1
VB – 6.0 SP 5
Client Access Express – Version 4 Release 4
Purpose: I am calling a stored procedures on the AS400 and sending two Parameters. The AS400 returns a recordset correctly, except that it is “Read-Only”.
My Problem: I cannot use the recorset.sort or edit any data in VB.
What I am Looking for: I want the recordset to be released from the AS400 so I can change the data. I do not want to change the data on the AS400. I want the recordset to be “marshaled” (if that is the correct use of the term) so I can manipulate the data in VB.
I have the following Code:
Public Sub GetRecordSet as adodb.recordset
Dim ADOcn As ADODB.Connection
Dim ADOcmd As ADODB.Command
Dim p1 As ADODB.Parameter
Dim p2 As ADODB.Parameter
Set ADOcn = New ADODB.Connection
ADOcn.CursorLocation = adUseClient
ADOcn.Open "Provider=IBMDA400;Data source=OURSYS";" & GetUserName & ", & GetPassword
Set ADOcmd = New ADODB.Command
Set ADOcmd.ActiveConnection = ADOcn
ADOcmd.CommandText ="{Call QGPL.GPC7060SP(?,?)”
ADOcmd.CommandType = adCmdText
ADOcmd.Prepared = True
Set p1 = New ADODB.Parameter
p1.Type = adVariant
p1.Direction = adParamInputOutput
p1.Value = “DALLAS”
ADOcmd.Parameters.Append p1
Set p2 = New ADODB.Parameter
P2.Type = adVariant
P2.Direction = adParamInputOutput
P2.Value = “RED”
ADOcmd.Parameters.Append p2
Set GetRecordSet = New ADODB.Recordset
GetRecordSet.CursorLocation = adUseServer
GetRecordSet.CursorType = adOpenKeyset
GetRecordSet.LockType = adLockBatchOptimistic
Set GetRecordSet = ADOcmd.Execute
Set ADOcmd = nothing
Set ADOcn = nothing
Exit sub