What Class is Used to Create a New Database?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello

What class do I use if I want to write a new database file for use with OleDB? I would like this to be a Jet database file that is compatible with MS Access

It looks like I can't execute any SQL statements without a valid connection, but it doesn't look like I can make a connection to a database file that doesn't yet exist

Thank you very much
Rich
 
Rich S said:
Hello,

What class do I use if I want to write a new database file for use with
OleDB? I would like this to be a Jet database file that is compatible with MS
Access.
It looks like I can't execute any SQL statements without a valid
connection, but it doesn't look like I can make a connection to a database file
that doesn't yet exist!
Thank you very much,
Rich

I haven't tried it myself, but you may want to look at OleDb connections for text
files and create the text file yourself....if you have to, programmatically
create a text file that will be used for comma delimited or such :)

Mythran
 
Mythran

Thank you for your response. I'm looking to create a new .MDB file, which is a Jet database file

Rich.
 
You can do it but you have to use the ADOX library.
There are plenty of code sampes so Google for Jet, .Net and ADOX and create
database.

The code works, but you have to use COM interop.
If you need to distribute the app and you don't want to be bothered with the
creation, you can always ship an empty copy of the .mdb file and copy it to
be the real file whenever you need to "create" one.
 
Try: http://www.smithvoice.com/dbcopier.aspx

Use this program to point at an Access MDB file, and it will create all the
code necessary to recreate the database from within a VB.Net program.

Regards.


--
------------------------------------------------------------------------
George Shubin Custom Software Development
dX Software Systems Database Applications
Ph: 503-981-6806 Fax: 503-982-0120
www.dxonline.com (e-mail address removed)
------------------------------------------------------------------------

Rich S said:
Hello,

What class do I use if I want to write a new database file for use
with OleDB? I would like this to be a Jet database file that is compatible
with MS Access.
It looks like I can't execute any SQL statements without a valid
connection, but it doesn't look like I can make a connection to a database
file that doesn't yet exist!
 
Hi Rich,

There is no dotNet class, however you can try this it is very simple to
create a empty mdb file.
set a reference to COM adox ext 2.x for dll and security
\\\
Dim catNewDB As New ADOX.Catalog
catNewDB.Create("Provider=Microsoft.Jet.OLEDB.4.0;" & "Data
Source=C:\db1.mdb")
///

I hope this helps a little bit?

Cor
 
Back
Top