473,396 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Create Access db Programatically

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
5 5587
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Viviana Vc | last post by:
How can I programatically do the equivalent of the following: cacls "C:\Program Files\test" /T /G Everyone:f ? Thanks, Viv
7
by: pintihar | last post by:
Hi, As a follow on from an earlier post I have another question about xslt. Is it possible to create the stylsheet programatically? Is this sensible? In the first phase I needed to map element...
8
by: Lumpierbritches | last post by:
Thank you in advance for any and all assistance, it is GREATLY appreciated. I was wondering if there is a way, with code to create a query for every table? Or can you use a naming convention in...
7
by: sea | last post by:
Is it a good idea to programatically create a primary key? For example in a table called names, I have the following fields, (1) firstname (2)lastname (3) ID - will it be ok to create a primary...
1
by: Mike Grishaber | last post by:
Hello All, Does anyone know how to programatically create an ODBC datasource in C#? I want to access some comma separated files using ODBC, and I don't want to go into the configuration...
3
by: The Woo | last post by:
Can one programatically create a file folder which has the same name as a key field, using a command button? Or, Can there be a a command button which opens up a directory tree to a specified...
3
by: ineedahelp | last post by:
Has anyone created a combo box from scratch with vba in access? I would like the AFTER UPDATE event to create a combo box and populate it with items dependent on what the user selects. I know how...
7
by: The Mad Ape | last post by:
Hi I have code to programatically create a label. It works but when I try to call a sub to create a tooltip it does not work. I do not get an error so have no idea what it wrong. Please review...
3
by: juing | last post by:
Hi Guys, is it possible to create an instance of ListBox programatically? Actually I have two issues here: 1.) When I type this line in Access 2003: Dim tmpList As ListBox Set tmpList = New...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.