Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO 2.6 Cursor Problem with SQL Server 7.0 & 2000

Status
Not open for further replies.

Foada

Programmer
Feb 4, 2002
1,110
US
Hi everyone,

Has anyone run across anything like this before. I have a basic ADO recordset that works fine with SQL Server 7 but fails with SQL Server 2000. Basically I use this code to retrieve the rs from within a function

FYI rsEditEmp is global
.
.
.
'Get a record set that contains all the data fields in the Employees Table For Editing
sSQL = "Select * From Employees Order By LastName Asc"

If rsEditEmp.State = adStateOpen Then 'Check Record Set State, Close If Needed
rsEditEmp.Close
End If

With rsEditEmp 'Establish Record Set Properties
.ActiveConnection = hDB
.CursorLocation = adUseServer 'Problem with SQL 2000, works with SQL 7
' .CursorLocation = adUseClient 'must use a client cursor with SQL 2000
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open sSQL
End With

rsEditEmp.Close
.
.
.

Then in a later function I attempt to just open the rs with this line of code

.
.
.
rsEditEmp.Open 'changes the cursor type and location

.
.
.
If I step thru the code (with SQL 2000) the cursor type changes when I open the rs to a clientside forward only? Then when I try to do a find I get the error "rowset doesn't support backwards scrolling" because the cursor was changed. As I said it works fine with SQL 7.If I run the clientside cursor with SQL 2000 it works but that is not the cursor I want. Why would Uncle Bill's wonderful improved SQL version change the cursor on just an open statement? Any suggestion? By the way I am using ADO 2.6 with Jet 40 Service Pack 3 and VB6 with Service Pack5. I have tried it on both a NT4 service pack 6a and a Win2k service pack2 machines with the same results. Thanks in advance. [bugeyed]
If you choose to battle wits with the witless be prepared to lose.
[machinegun][hammer]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top