Closing an ADOX connection?

A

Amil

I have to CREATE an Access database via C#. ado.net doesn't allow CREATING.
So, I used ADOX (ActiveX Data Objects (ADO)) from C#. Fine. In anycase,
once I am done have have an active connection to the Access database.

Does anyone know how to close this via ado.net? I've tried telling Interop
to ReleaseComObject, but that doesn't close it. It doesn't appear I can
create an OleDbConnection from an ADOX.ActiveConnection property?

Ahhhhh! Help.

Amil
 
A

Amil

I added a COM reference for ADODB (Microsoft ActiveX Data Objects 2.8
Library) and then did a:

ADODB._Connection adocc = (ADODB._Connection)cat.ActiveConnection;
adocc.Close();

This worked in closing the ADOX catalog (cat in the above code) connection.

Amil
 
O

Otis Mukinfus

I added a COM reference for ADODB (Microsoft ActiveX Data Objects 2.8
Library) and then did a:

ADODB._Connection adocc = (ADODB._Connection)cat.ActiveConnection;
adocc.Close();

This worked in closing the ADOX catalog (cat in the above code) connection.

Amil

Amil,

I see you've solved your problem.

I just wanted to say that you can also use DAO from C#. That's the way I do
Compact and repair ;o)


Otis Mukinfus
http://www.otismukinfus.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top