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

Rowset cannot be restarted

Status
Not open for further replies.

objuan

Programmer
Jun 27, 2002
13
US
I have run into an error when trying to manage a Recordset that is being pulled by a Function that runs a Stored Procedure to a SQL DB using an ADO Command that executes the stored procedure by sending the parameters through. The RecordSet seems to be returning okay, but I can't seem to set the Cursor properties to allow dynamic scrolling. The error I'm getting is "Rowset cannot be restarted" when I try to move the cursor to the beginning of the Recordset after it is used once. I can't tell if it is a SQL issue, or an ASP issue.
 
Sounds like a cursor issue...post some of your code...
 
This part is on the ASP page and calls the function Get Data
Set rs = Server.CreateObject("ADODB.Recordset")
Set rs= GetData(iOrgID, iAccountID)

This is the function:

'*********************************************************************
Function GetData(ByVal iOrgID, ByVal iAccountID)
Dim cmdGetData
Dim dbConnection
Dim rs

'Set the Connection string
Set dbConnection= CreateObject("ADODB.Connection")
Set cmdGetData= CreateObject("ADODB.Command")
Set rs = CreateObject("ADODB.Recordset")
dbConnection.Open sConnString

With cmdGetData
.CommandType = adCmdStoredProc
Set .ActiveConnection = dbConnection
.CommandText = "sp_GetData"
.Parameters.Append .CreateParameter("@OrgID", adInteger, adParamInput, ,iOrgID)
.Parameters.Append .CreateParameter("@AccountID", adInteger, adParamInput, ,iAccountID)
Set rs = .Execute
End With

Set GetData = rs
Set cmdGetData = Nothing
Set dbConnection = Nothing
End Function

Then once the recordset is pulled into the ASP page, I am trying to use it more than once...so I scroll through it the first time, and the do a .MoveFirst so it starts at the top of the recordset...this is where I'm getting the error.

Any advice would be greatly appreciated. I've tried setting CursorType, CursorLocation, and LockType to see if I get it to work without much success. Rowset sounds like it is something coming from SQL Server.

Thanks in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top