borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2010 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (adding other control in FlexGrid or Listview control)Next Topic (any sample of bus ticketing database?) New Topic New Poll Post Reply
AndreaVB Forum : Database : Error on my codes
Poster Message
halim27
Level: Trainee

Registered: 28-01-2009
Posts: 1

Ads by Lake Quincy Media
icon Error on my codes

im encountering this error "operation is not allowed when  the object is open" i just key in thios syntax :

rs.Open "select sum(Q1) as Total from zeus"

Text1.Text = rs!total  'this command will display the total into the text box.
  

Ads by Lake Quincy Media
28-01-2009 at 10:46 AM
View Profile Send Email to User Show All Posts Visit Homepage ICQ | Quote Reply
stickleprojects
Level: Moderator


Registered: 09-09-2002
Posts: 1060
icon Re: Error on my codes

you have declared a variable called "rs" somewhere in your code.
prior to the statement you have illustrated, the "rs" is already being "opened".
I suggest you look for "rs.open" in your code and make sure it does not happen prior to this line of text.
to stop the error occuring, do the following:


if not (rs is nothing) then
    if rs.state = adStateopen then rs.close
    set rs = nothing
end if
set rs = new recordset
rs.open........

hope this helps


____________________________
Build it better, faster, quicker, easier.. then fix it (non-offical MS mission statement)

29-01-2009 at 09:06 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Database : Error on my codes
Previous Topic (adding other control in FlexGrid or Listview control)Next Topic (any sample of bus ticketing database?) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2010 Andrea Tincaniborder