Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Client Side Cursor using ADO Command Object
Message
From
15/08/2000 12:13:30
 
 
To
15/08/2000 07:23:03
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00404031
Message ID:
00405026
Views:
19
You mean.....I was right? :-)

>Sorry for the reply delay, got BSOD on my machine yesterday. JVP listed several issues to consider. We expected a client side recordset which should not need a connection. We also found that by removing the MyConn.Close, the problem went away. ADO is relatively new to me so I'll have to study some of the issues.
>
>Bill
>
>>Hi Bill,
>>
>>It's late and I'm in no mood to test this (lol) but why would you expect the Recordset data to remain available when you've wiped out the Connection object? Not having tried this, I don't know if that's expected behavior but it sure doesn't feel right.
>>
>>>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
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform