PDA

Click to See Complete Forum and Search --> : ADO or DAO


kovan
Aug 22nd, 2000, 09:05 AM
really confused
til THIS day i thought i had referenced ADO
i checked my project
and DAO was selected :(

DAO 3.51 to be exact

and when i have like
public db as database
it works fine
but how do i change it to ADO and still have that declaration working?

thanks
am so confused about this

Chuck Sweet
Aug 22nd, 2000, 09:09 AM
sorry, kovan, you can't. in ado, there is not a database object. look into a adodb.connection object in help. that's what replaced the database objects. it's relatively easy to use. keep in mind that there are still some limitations to ado functionality, so you might be better off (depending) on using dao after all.
chuck

kovan
Aug 22nd, 2000, 09:29 AM
between DAO and ADO which one should i use to do a access db
adding, modifying recordS?

Chuck Sweet
Aug 22nd, 2000, 10:29 AM
microsoft is going with ado. they (plan to) eventually do away with dao, but ado isn't up to the task yet. the only real problem with ado at the time is that i don't think there's a way to compact and repair databases on the fly. you can always shell a second utiliy to take care of this, or fix it any number of ways. i use ado because of the continuing support. dao also does a lot with password protection and groups and stuff that i'm not sure if ado does, but i don't think so. if you are working with a relatively small database in which you will mainly update or add data, and you have a trustworthy database administrator, then ado is the way to go. if a lot of data is coming in AND leaving your database or you don't trust the dbadmin, then go dao and compact and repair to keep it manageable. your call.
chuck

ps. if you're just learning, pick one. they're close enough alike for it not really to matter

kovan
Aug 22nd, 2000, 11:43 AM
well i am somewhere new and somewhat not hehe

when i started this project
i thought i was doing ado..
today i just happen to look at my reference a little carefully and saw that i was using DAO
but your right, they are closely alike

like .addnew, .update, .edit ect

all my records are declated as rs as recordset...

i dont know if its worth changing them all to ado
you would know more...


thanks for the replies

JHausmann
Aug 22nd, 2000, 12:00 PM
Look at it this way. If you're new (and you say you are), do you want to learn 2 database access methods or one? If your answer is one, Learn ADO else learn both.

kovan
Aug 22nd, 2000, 01:42 PM
like i mentioned above.... i have done my whole project using DAO (thinking i did it in ADO) since their syntax for going throu records, and sql statements are close to similiar

ya i want to learn ado more than dao, dao is toast in future

but should i convernt my project to ADO
or keep it the way it is?

parksie
Aug 22nd, 2000, 01:52 PM
Definitely convert to ADO. There is little against using it with a supported provider (like Jet, SQL server).

And it seems faster...does anyone else have any experience of comparing speeds?

Chuck Sweet
Aug 22nd, 2000, 02:10 PM
i took a professional class on it, and it is faster ... depending on what you're working on. ADO supports multiple platforms easier, but DAO is more efficient (supposedly) for MDB files. when i get the time, i'll post a list of comparison info for you guys.
chuck

parksie
Aug 22nd, 2000, 02:13 PM
Yeah, that would be helpful.

kovan
Aug 22nd, 2000, 02:24 PM
after realizing my coding sucks :)

i decided to change my coding if it wont take more than a week of time

here are few things i like to know
(question mark(?) representing what woudl ADO version would be..


dao" dim db as database"
ado "?"

dao "dim rs as recordset"
ado "?"

dao "set db = OpenDatabase("myBadDatabase.MDB")"
ado "?"

dao "sql="SELECT * FROM MyTable""
"set rs = db.opendatase(sql)"
ado "?"

HERE IS A EXAMPLE FROM MY PROJECT (DAO)
if anyone would be kind enough to rewrite that with ADO
i would greatly appreciated, since it will help me do my conversion


Public Sub LoadManufacturer(cboBox As Object, Optional idx As Integer = -1)

SQL = "SELECT * FROM manufacturer"
Set ManufRecord = MeterInfo.OpenRecordset(SQL)

With ManufRecord
If .EOF Then
MsgBox "ERROR: Manufacturer table found to be empty"
Else
If idx = -1 Then
Do Until .EOF
cboBox.AddItem !Manu
.MoveNext
Loop
'cboBox.ListIndex = 0
Else
Do Until .EOF
cboBox(idx).AddItem !Manu
.MoveNext
Loop
'cboBox(idx).ListIndex = 0
End If
End If

End With

End Sub

parksie
Aug 22nd, 2000, 02:30 PM
The database object has (from a systems POV), been replaced by the Connection object. The Recordset is still there, though. It mostly works in the same way, once you've actually connected.