Home All Groups Group Topic Archive Search About

DAO data control or DAO instantiation

Author
8 Nov 2005 1:12 AM
the_grove_man@yahoo.com
I guess my question can go in two directions. I create applications
that run multiple queries against a database. Generally speaking in the
past I have used a Data Control (calling it dat1) making it invisible
and have used this whenever i needed it.

dat1.databasename = app.path & "mydatabase.mdb"
dat1.recordsource = "my query"
dat1.refresh

Lately I have seen that most programmers instantiate this when they
need it. For example, in typical DAO style.

dim db as database
set db = OpenDatabase(app.path & "\mydatabase.mdb")

dim rs as recordset
set rs = OpenRecordsets("my table or query")

My question is this. Is it better to instantiate it whenever I use it
or just use one control throughout my program and re-open it when I
need it. Which is better on memory?

My question is not just for DAO, ADO also has a data control or I can
instantiate that as well.

Which is better on memory?

Author
8 Nov 2005 4:44 AM
Scott M.
Your post doesn't seem to have to do with ADO.NET as you are asking about
DAO and ADO and using VB 6.0 syntax.



<the_grove_***@yahoo.com> wrote in message
Show quote
news:1131412352.347531.143910@z14g2000cwz.googlegroups.com...
>I guess my question can go in two directions. I create applications
> that run multiple queries against a database. Generally speaking in the
> past I have used a Data Control (calling it dat1) making it invisible
> and have used this whenever i needed it.
>
> dat1.databasename = app.path & "mydatabase.mdb"
> dat1.recordsource = "my query"
> dat1.refresh
>
> Lately I have seen that most programmers instantiate this when they
> need it. For example, in typical DAO style.
>
> dim db as database
> set db = OpenDatabase(app.path & "\mydatabase.mdb")
>
> dim rs as recordset
> set rs = OpenRecordsets("my table or query")
>
> My question is this. Is it better to instantiate it whenever I use it
> or just use one control throughout my program and re-open it when I
> need it. Which is better on memory?
>
> My question is not just for DAO, ADO also has a data control or I can
> instantiate that as well.
>
> Which is better on memory?
>
Author
8 Nov 2005 4:04 PM
John Grove
Yes, I apologize, I asked this question in the wrong group. Yes I am
referring to VB6.

*** Sent via Developersdex http://www.developersdex.com ***

AddThis Social Bookmark Button