Skip to main content

CreateObject(" ADOCE>Recordset.3.1" )

View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [eMbedded Visual Tools] >> eVB Development >> CreateObject(" ADOCE>Recordset.3.1" ) Page: [1]
Message << Older Topic   Newer Topic >>
CreateObject(" ADOCE>Recordset.3.1" ) - 7/16/2003 11:12:16 AM   


Posts: 40
Joined: 4/26/2002
From: MO
Status: offline
Hi All,

I have develped application using eVB and Pocket Access database.Application works fine sometimes but sometimes

set rs=CreateObject(" ADOCE.Recordset.3.1" ) does not work,it
throws error saying" Operation is not allowed on closed object" .

But according to my knowledge CreateObject just creates object of recordset type.

Why I am surprized is that it is working sometimes.I am using lots of devices to test my application.

I am opening recordset in many places with the same table.
But I have only one connection object which I opens once
and keep alive till end of application.

Hope somebody will put some light in my brain.

Thanks in advance
Post #: 1
RE: CreateObject(" ADOCE>Recordset.3.1" ) - 7/16/2003 11:30:02 AM   


Posts: 290
Joined: 12/11/2002
Status: offline
I don' t know if this helps or comes close to answering your question, but apparently there is a memory leak in eVB when you create and destroy rs objects many times in an application.

Do you only create the rs object once in your application? If not you might want to try that. Just create a public rs object and create it only once and then just simply open and close it throughout your application. Then just destroy it when you close your application. You shouldn' t get that error then either.

If you are already doing that than I apologize for this babbling, and I' ll have to think more about your issue.

hope that helps

(in reply to devchand)
Post #: 2
RE: CreateObject(" ADOCE>Recordset.3.1" ) - 7/16/2003 11:46:25 AM   


Posts: 40
Joined: 4/26/2002
From: MO
Status: offline
I am not using global rs object.I am aware of memory leak in I am using OSIUtil library developed by Odyssys

Here is the detail about what am i doing.

Public conn As ADOCE.Connection
Dim Factory As OSIUTIL.Win32 ' used to remove memory leak.

On Startup form(aaplication starts here)

Set Factory = CreateObject(" OSIUTIL.Win32" )
' Create and destroy one ADOCE object to get the
' ADOCE enumerations into memory.
Dim dbConn
Set dbConn = CreateObject(" ADOCE.Connection.3.1" )
Set dbConn = Nothing

Set conn = Factory.CreateObject(" ADOCE.Connection.3.1" )' global connection.

Here is detail how I am doing on each form.

Dim sql, rs, Msg
Set rs = Factory.CreateObject(" ADOCE.Recordset.3.1" )
sql = " select * from tblpostdeploy2 where SoldierId =" & " ' " & providerReview.txtsoilderid.Text & " ' "
rs.Open sql, conn, adOpenDynamic, adLockOptimistic
If rs.EOF And rs.bof Then
Set rs = Nothing
Exit Sub
If rs(" Health_assessment" ) = " E" Then
rdQ1_Excellent.Value = True
ElseIf rs(" Health_assessment" ) = " V" Then
rdQ1_VeryGood.Value = True
ElseIf rs(" Health_assessment" ) = " G" Then
rdQ1_Good.Value = True
ElseIf rs(" Health_assessment" ) = " F" Then
rdQ1_Fair.Value = True
ElseIf rs(" Health_assessment" ) = " P" Then
rdQ1_Poor.Value = True
End If

If (rs(" med_problems" ) = " Y" ) Then
rdQ2_YesMedProblem.Value = True
ElseIf rs(" med_problems" ) = " N" Then
rdQ2_NoMedProblem.Value = True
End If
End If
Set rs = Nothing

when application destroys I do
if conn.state=1 then
Set Factory= Nothing

Am i Doing any wrong here.Sometimes I need to open more
than one recordsets.
please suggest me if something is wrong.Becase once in while I get error when I do createObject(" ADOCE.Recordset.3.1" ).Its not consistent

Thanks in Advance

< Message edited by devchand -- 7/16/2003 11:47:53 AM >

(in reply to devchand)
Post #: 3
RE: CreateObject(" ADOCE>Recordset.3.1" ) - 7/16/2003 3:03:09 PM   


Posts: 290
Joined: 12/11/2002
Status: offline
Since I don' t create more than one rs object, I may be wrong here, so someone else please feel free to interject, but it seems like when you get that error it' s because you have not set rs = nothing before trying to recreate it. And since you say that it only happens sometimes, there may be a certain scenario that happens in your if statement that isn' t destroying it when it is supposed to.

Isn' t there a property you can check to see if it has been created? If not one other solution may be to check the state of the object. If it is either opened or closed that means it must still be created and then you could destroy it first. If it doesn' t exist you would probably get some kind of error and you could trap for that error and then clear the error and continue on. This may be just a bandaid to the real problem, but it may work.


< Message edited by faithwalker -- 7/16/2003 3:03:51 PM >

(in reply to devchand)
Post #: 4
Page:   [1]
All Forums >> [eMbedded Visual Tools] >> eVB Development >> CreateObject(" ADOCE>Recordset.3.1" ) Page: [1]
Jump to:

New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts

Forum Software © ASPPlayground.NET Advanced Edition 2.5.5 Unicode