Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Client Side Cursor using ADO Command Object
Message
De
11/08/2000 13:25:16
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Titre:
Client Side Cursor using ADO Command Object
Divers
Thread ID:
00404031
Message ID:
00404031
Vues:
108
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.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform