Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Client Side Cursor using ADO Command Object
Message
From
15/08/2000 07:27:55
 
 
To
12/08/2000 00:18:11
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00404031
Message ID:
00404846
Views:
10
Hi Mal,

Thanks for the reply and sorry for my reply delay. As I explained to the others, my machine went BSOD yesterday so I had to deal with that.

In regard to the Set rs=nNthing statement, yes it would be the same as rs=.NULL. in VFP. However, just before that I issue

Set GetAttribsByName = rs ' To pass the recordset back

which sets up the record set to be passed back as the return value of the function.

Bill

>Hi Bill:
>
>I've been working with ADO recently - in VFP. In your code, just before MYCONN.CLOSE, you have SET RS = NOTHING. Is this the same as, in VFP, RS = .NULL.? If so, then I've found that that will clear your RS (object entirely).
>
>Hope I understood your question & HTH
>
>Mal
>
>>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.
Previous
Reply
Map
View

Click here to load this message in the networking platform