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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

recordset can't move back HELP !!

Status
Not open for further replies.

TRYP

Programmer
Jun 20, 2000
136
0
0
US
HELP !!

In the following code after i get the recordset i can use 'moveNext' but when i use 'moveBack' i get an error that the recordset does not support backward fetching.

Any Ideas !!?!!?!?

TRYP


Private Sub Command1_Click()
On Error GoTo Err_Handler
Dim cmdSP As New ADODB.Command
Dim DataConn As New ADODB.Connection

ConnectionString = "driver={SQL server};server=SMaster-PDC;database=space2000;"
DataConn.Open ConnectionString

With cmdSP
Set .ActiveConnection = DataConn
.CommandType = adCmdStoredProc
.CommandText = "retusers"
Set rs = .Execute ' New ADODB.Recordset
End With

Set cmdSP = Nothing
Set DataConn = Nothing
Exit Sub
Err_Handler:

' Set RunSPNoParams = Nothing
Set cmdSP = Nothing
Debug.Print Err.Description
Set DataConn = Nothing

End Sub
 
Where did "moveback" come from? Can you show the code where you attempt it?
 
Check this: thread222-160643
Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
 
Here's some code I did once to create a fully scrollable disconnected recordset:

'open connection
Set oConn = New ADODB.Connection
With oConn
.ConnectionString = msDestConnectionString
.Open
End With

'prepare the command
Set oCmd = New ADODB.Command
With oCmd
.NamedParameters = True
.CommandType = adCmdStoredProc
.CommandText = "uspGetConfig"
.ActiveConnection = oConn
End With

'open the recordset
Set oRS = New ADODB.Recordset
With oRS
.CursorLocation = adUseClient
.Open oCmd
Set .ActiveConnection = Nothing
End With

You can use .MoveNext, .MovePrevious with it. -Chris Didion
Matrix Automation, MCP
 
Thanks a lot cdidion, sunaj
i want to use this bit of code in a com obj eventually, this will help a lot thanks again.

courtoisf moveback or moveprevious i think we all knew what i meant.

untill i bug again !!!

tryp
 
Sorry Tryp. Didn't mean to cause a stir. Moveback actually IS a keyword, but not in the context you were in. I was asking to see the code where it was actually used to see if there was more involved. Here's a curious question to all of you though, if this is to just open a recordset, is there an advantage to using a command object as the tool, rather than the recordset.open's inline parameters? I tend to avoid the command approach when creating recordsets to cut down on the overhead of carrying another object, no matter how briefly, but if the command object gives some kind of advantage, I'd love to know. Any input?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top