By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,908 Members | 2,055 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,908 IT Pros & Developers. It's quick & easy.

Create Access db Programatically

P: n/a
Happy New Year!

I'm writing a program that will need to store large amounts of data from
several DataSets that I create at runtime (for information like email,
calendar, etc...). The trick is that these files will need to be created
programmatically. I think saving the DataSets into Access .mdb files is a
logical choice, but I'm unable to find any information for creating NEW
databases programmatically and I can only find information on connecting to
existing databases. So my question is:

How can I create a new database file programmatically and populate it with a
DataSet?

I've read the article: HOW TO: Create an Access Database Using ADOX and
Visual C# .NET (http://support.microsoft.com/?id=317881). With that I can
create a new empty .mdb file and creating the DataSet is no problem, but
that's as far as I've got.

If someone could suggest a solution, or an alternative I would appreciate
it.

Thanks,
Jacob
Nov 15 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Jacob wrote:
How can I create a new database file programmatically and populate it with
a DataSet?
What's wrong with exportin/importing using XML?
I've read the article: HOW TO: Create an Access Database Using ADOX and
Visual C# .NET (http://support.microsoft.com/?id=317881). With that I can
create a new empty .mdb file and creating the DataSet is no problem, but
that's as far as I've got.


Once you've got the database constructed, use an OleDbAdapter to read and
write information from/to the database. Better yet, if you already know the
structure of your database, create it now and simply ship it with your app.

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
Nov 15 '05 #2

P: n/a
Will the structures of the databases always be the same? Do you know the
structure ahead of time? If so, then you might just create some empty
database templates that you can simply copy to the destination. Then you
can connect and load the data.

"Jacob" <ja**********@hotmail.com> wrote in message
news:zsJIb.16689$7D3.5336@fed1read02...
Happy New Year!

I'm writing a program that will need to store large amounts of data from
several DataSets that I create at runtime (for information like email,
calendar, etc...). The trick is that these files will need to be created
programmatically. I think saving the DataSets into Access .mdb files is a
logical choice, but I'm unable to find any information for creating NEW
databases programmatically and I can only find information on connecting to existing databases. So my question is:

How can I create a new database file programmatically and populate it with a DataSet?

I've read the article: HOW TO: Create an Access Database Using ADOX and
Visual C# .NET (http://support.microsoft.com/?id=317881). With that I can
create a new empty .mdb file and creating the DataSet is no problem, but
that's as far as I've got.

If someone could suggest a solution, or an alternative I would appreciate
it.

Thanks,
Jacob

Nov 15 '05 #3

P: n/a
It wouldn't be practical for me to store information in XML. These
databases will be VERY large. I've run some tests and found that if I save
in XML, the file sizes would be several dozen megabytes large. In an Access
db, they would be almost 1/5 - 1/6 the size.

You're right, I can create the database and ship it with the app, but was
hoping not to have to.

Thanks,
Jacob

"Frank Oquendo" <fr****@acadxpin.com> wrote in message
news:en****************@TK2MSFTNGP10.phx.gbl...
Jacob wrote:
How can I create a new database file programmatically and populate it with a DataSet?
What's wrong with exportin/importing using XML?
I've read the article: HOW TO: Create an Access Database Using ADOX and
Visual C# .NET (http://support.microsoft.com/?id=317881). With that I can create a new empty .mdb file and creating the DataSet is no problem, but
that's as far as I've got.


Once you've got the database constructed, use an OleDbAdapter to read and
write information from/to the database. Better yet, if you already know

the structure of your database, create it now and simply ship it with your app.
--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)

Nov 15 '05 #4

P: n/a
I was hoping not to have to do that. I always worry that if the file
becomes corrupted or the user does something stupid, that the application
would fail. But if I could create the db programtically, I could construct
a new one on the fly.

Jacob

"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:uw**************@TK2MSFTNGP12.phx.gbl...
Will the structures of the databases always be the same? Do you know the
structure ahead of time? If so, then you might just create some empty
database templates that you can simply copy to the destination. Then you
can connect and load the data.

"Jacob" <ja**********@hotmail.com> wrote in message
news:zsJIb.16689$7D3.5336@fed1read02...
Happy New Year!

I'm writing a program that will need to store large amounts of data from
several DataSets that I create at runtime (for information like email,
calendar, etc...). The trick is that these files will need to be created programmatically. I think saving the DataSets into Access .mdb files is a logical choice, but I'm unable to find any information for creating NEW
databases programmatically and I can only find information on connecting to
existing databases. So my question is:

How can I create a new database file programmatically and populate it with a
DataSet?

I've read the article: HOW TO: Create an Access Database Using ADOX and
Visual C# .NET (http://support.microsoft.com/?id=317881). With that I

can create a new empty .mdb file and creating the DataSet is no problem, but
that's as far as I've got.

If someone could suggest a solution, or an alternative I would appreciate it.

Thanks,
Jacob


Nov 15 '05 #5

P: n/a
Most programs out their ship with satellite files. If the user chooses to
modify these files outside of the application's control and in undocumented
ways, there is really not anything you can do about that.

But, an alternative might be to embed a pre-fabricated database as a
resource in your application. That way it is actually compiled as part of
your executable. Then you would simply stream the binary data back to disk
when needed.
"Jacob" <ja**********@hotmail.com> wrote in message
news:wRKIb.16702$7D3.9134@fed1read02...
I was hoping not to have to do that. I always worry that if the file
becomes corrupted or the user does something stupid, that the application
would fail. But if I could create the db programtically, I could construct a new one on the fly.

Jacob

"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:uw**************@TK2MSFTNGP12.phx.gbl...
Will the structures of the databases always be the same? Do you know the
structure ahead of time? If so, then you might just create some empty
database templates that you can simply copy to the destination. Then you can connect and load the data.

"Jacob" <ja**********@hotmail.com> wrote in message
news:zsJIb.16689$7D3.5336@fed1read02...
Happy New Year!

I'm writing a program that will need to store large amounts of data from several DataSets that I create at runtime (for information like email,
calendar, etc...). The trick is that these files will need to be created programmatically. I think saving the DataSets into Access .mdb files is
a
logical choice, but I'm unable to find any information for creating
NEW databases programmatically and I can only find information on connecting to
existing databases. So my question is:

How can I create a new database file programmatically and populate it

with
a
DataSet?

I've read the article: HOW TO: Create an Access Database Using ADOX

and Visual C# .NET (http://support.microsoft.com/?id=317881). With that I

can create a new empty .mdb file and creating the DataSet is no problem, but that's as far as I've got.

If someone could suggest a solution, or an alternative I would appreciate it.

Thanks,
Jacob



Nov 15 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.