VB.NET create JET database without ADOX

D

Dan Hinsley

I'm converting an app over to VS 2005, and am trying to get rid of all
the external references possible. I use JET to create a database.
Before I used the ADOX.Catalog function to do this. I assume that
there's got to be a way to do this with ADOX, but I haven't been able
to get there.

I have to have a connection to issue the CREATE DATABASE command, but
if I use Data Source=foo, where foo is the name I want the file to be,
connect fails with file not found. If I leave Data Source off the
connection I get a DB_SEC_E_AUTH_FAILED. Is there an equivalent to
Data Source=(local) for JET? Or how can I completely create a
database without resorting to ADOX?

Thanks,

Dan
 
P

Paul Clement

¤ I'm converting an app over to VS 2005, and am trying to get rid of all
¤ the external references possible. I use JET to create a database.
¤ Before I used the ADOX.Catalog function to do this. I assume that
¤ there's got to be a way to do this with ADOX, but I haven't been able
¤ to get there.
¤
¤ I have to have a connection to issue the CREATE DATABASE command, but
¤ if I use Data Source=foo, where foo is the name I want the file to be,
¤ connect fails with file not found. If I leave Data Source off the
¤ connection I get a DB_SEC_E_AUTH_FAILED. Is there an equivalent to
¤ Data Source=(local) for JET? Or how can I completely create a
¤ database without resorting to ADOX?

Creating a Jet database using code requires either DAO, ADOX or automation with Microsoft Access.


Paul
~~~~
Microsoft MVP (Visual Basic)
 
D

Dan Hinsley

Are any of these available as part of .NET 2.0? Or do I have to
include a reference to an external DLL for any of the three?

Thanks,

Dan
 
P

Paul Clement

¤ Are any of these available as part of .NET 2.0? Or do I have to
¤ include a reference to an external DLL for any of the three?
¤

You just need to add the COM reference for whichever library you choose to use. I'm afraid there is
no way around using interop in this instance.


Paul
~~~~
Microsoft MVP (Visual Basic)
 
P

Paul Clement

One other option I suppose I should mention is that you could just distribute an empty database and
use it as a template to create new database files.


Paul
~~~~
Microsoft MVP (Visual Basic)
 
C

Cor Ligthert [MVP]

Paul,

I could have answered this before you. I thought let me not do it, not that
Paul has found some news the last days.

:)

Cor
 
P

Paul Clement

¤ Paul,
¤
¤ I could have answered this before you. I thought let me not do it, not that
¤ Paul has found some news the last days.
¤

Cor,

You're certainly welcome to answer the question before me, just as long as you do so correctly. ;-)

I split my time between forums (MSDN, DevX) so sometimes it takes me longer to respond to posts.


Paul
~~~~
Microsoft MVP (Visual Basic)
 

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