Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Client Side Cursor using ADO Command Object
Message
From
11/08/2000 13:25:16
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Client/server
Title:
Client Side Cursor using ADO Command Object
Miscellaneous
Thread ID:
00404031
Message ID:
00404031
Views:
107
ADO 2.5. I am trying to create a client side cursor using an ADO Command object executing a SQL Server stored procedure which returns the record set.

Following is the VB ( horrors :-) ) code. The commented out code using the Recordset.Open syntax works successfully. The problem is at the MyConn.Close statement, at which the data ( supposedly Client side ) goes away and nothing is returned:
Dim objUtil As Inventory.InvUtilities
Dim MyConn As ADODB.Connection
Dim objCmd As ADODB.Command
Dim rs As ADODB.Recordset
Dim strStoredProc As String
Dim lngRecordsAffected As Long
    
' Create the utility object used to get the connection
Set objUtil = CreateObject("Inventory.InvUtilities")
Set MyConn = objUtil.GetConnection() ' Connection object CursorLocation is declared as adUseClient
    
Set objCmd = New ADODB.Command
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient ' Make sure it is client side
    
With objCmd
   .ActiveConnection = MyConn
   .CommandText = "usp_GetSKUAttributesListByName"
   .CommandType = adCmdStoredProc
   Set rs = .Execute(lngRecordsAffected, Array(strName), adCmdStoredProc)
   .ActiveConnection = Nothing
End With

'    strStoredProc = "usp_GetSKUAttributesListByName " & "('" & Trim(strName) & "')"
'
'    With rs
'        .CursorLocation = adUseClient
'        .Open strStoredProc, MyConn, adOpenForwardOnly, adLockReadOnly, adCmdStoredProc
'        .ActiveConnection = Nothing
'    End With

Set GetAttribsByName = rs ' To pass the recordset back

'   Clean up references
Set rs = Nothing
MyConn.Close ' The recordset data goes away at this command
Set MyConn = Nothing
Set objUtil = Nothing

Exit Function
I am missing something here but I don't know what it is.

Thanks,
Bill
William A. Caton III
Software Engineer
MAXIMUS
Atlanta, Ga.
Next
Reply
Map
View

Click here to load this message in the networking platform