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

Recordset closing prematurely

Status
Not open for further replies.

BG12424

Programmer
Jun 4, 2002
717
US
Here is my code. I am trying to execute this, but I get a return message indicating that the recordset is closed. I don't understand why this is telling me this. Thanks for your help.


if userid = "" then userid = 0

dim cmd, rs, dbConn, retval

Set dbConn = Server.CreateObject("ADODB.Connection")
dbConn.Open strConn

Set cmd = Server.CreateObject("ADODB.Command")
with cmd
.ActiveConnection = dbConn
.CommandText = "WVCalculateMargin"
.CommandType = adCmdStoredProc
.Parameters.Append .CreateParameter("RETURN_VALUE", adInteger,adParamReturnValue)
.Parameters.Append .CreateParameter("@userID",adInteger,adParamInput, ,userid)
.Execute
retval = .Parameters("RETURN_VALUE")
end with

if retval = 1 then
Response.Write("Invalid User")
else
Set rs = Server.CreateObject("ADODB.Recordset")
Set rs = cmd.Execute
do while not rs.EOF ' GETTING ERROR HERE BECAUSE RS OBJECT IS APPARENTLY CLOSED
Response.Write(rs(&quot;ID&quot;) & &quot;<br>&quot;)
Response.Write(rs(&quot;BALANCE&quot;) & &quot;<br>&quot;)
Response.Write(rs(&quot;EQUITY&quot;) & &quot;<br>&quot;)
Response.Write(rs(&quot;MARGIN&quot;) & &quot;<br>&quot;)
Response.Write(rs(&quot;PROFIT&quot;) & &quot;<br>&quot;)
Response.Write(rs(&quot;TRADING_POWER&quot;) & &quot;<br>&quot;)
Response.Write(&quot;<HR>&quot;)
rs.MoveNext
loop
CloseRS(rs)
end if

CloseCmd(cmd)
CloseDBConn(dbConn) regards,
Brian
 
Did you try moving your CloseRS(rs) to outside the end if? &quot;Damn the torpedoes, full speed ahead!&quot;

-Adm. James Farragut

Stuart
 
Are the spaces after - 'Parameters.Append ' intentional??? Saturday 12.00
im6.gif
im2.gif
im2.gif
20.00
im5.gif
im4.gif
im7.gif
3.00am
im8.gif
Sunday [img http
 
regarding 'Parameters.Append ' intentional???

This is the syntax. regards,
Brian
 
Yes, I tried moving the CloseRS(rs) outside the if condition. Thanks regards,
Brian
 
Any ideas on this? I'm still stuck on it? Thanks regards,
Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top