Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Object is open while Record set is already closed

Author  Topic 

sha_agrawal
Starting Member

24 Posts

Posted - 2010-02-01 : 08:17:47
I am using SQL Server 2000 and VB6. Below given code works fine for the first time and next time it raises error that 'object is open' at last line. I have already closed RS(RecordSet), is there any way to close Command(CmdForSP) too.

If RS.State = 1 Then RS.Close
CmdForSP.CommandText = "SPToShowPrevMonthAtStartUp"
CmdForSP.CreateParameter 'year parameter is to passed
CmdForSP.Parameters.Append CmdForSP.CreateParameter("sp_yr", adInteger, adParamInput, , Val(TxtPrvYr.Text))
RS.CursorType = adOpenDynamic
RS.LockType = adLockOptimistic
RS.Open CmdForSP.Execute

Pls.help me.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-01 : 08:46:31
you've not given rs.open inside any condition so even if its already open it will again try to open it. is above code inside any loop?
Go to Top of Page
   

- Advertisement -