PDA

Click to See Complete Forum and Search --> : Testing DAO connection


icemanmt78
Jul 5th, 2000, 07:48 AM
I am trying to find out how to test connections to databases.

How do i test if a database i am connecting to has opened correctly. Is there a property that will give me a boolean value.

Also when i run a sql statement that will populate a new table, am i able to interrogate the table with DAO to see if its been populated. Any help would be good .

Finally, is there a way of interrogating a database to see if a table exists.

I am using VB5 DAO and ACCCESS 97

M

JHausmann
Jul 5th, 2000, 05:12 PM
Originally posted by icemanmt78
I am trying to find out how to test connections to databases.

How do i test if a database i am connecting to has opened correctly. Is there a property that will give me a boolean value.

M

Check err.number after issuing the open. If it's not 0 you had a problem opening the database.

Originally posted by icemanmt78
Also when i run a sql statement that will populate a new table, am i able to interrogate the table with DAO to see if its been populated. Any help would be good .
M [/B]

Select count(*) from table

If you run before and after your population you will find out how many records (if any) have been added, assuming no one else is doing the same thing at the same time.

Originally posted by icemanmt78
Finally, is there a way of interrogating a database to see if a table exists.

I am using VB5 DAO and ACCCESS 97

M [/B]

As before, select count(*) from table, then check the err.number returned after the SQL execution.