473,387 Members | 1,483 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,387 software developers and data experts.

How do you create a Access Database for a setup project

Hi, I am developing a c# windows .NET application. The application is going
to run on a standalone PC and use an access database. I have figured out that
I will need to create a project and add it to the custom actions of the my
setup project to create the database.

How do I create the database and then add a table using C#? Also, should I
use an odbc data adapter, which I usually use with Access and if so how do I
register the new database I have just created from my custom action project
as an ODBC database.

Any help would be greatly appreciated, I imagine the answer to this question
could help quite a lot of people who use Windows Apps/Access for small
projects and want to create an installer for them.
Feb 8 '06 #1
4 3387
Hello Paul,

Add reference to the COM lib "Microsoft ADO Ext 2.8 for DLL and security"
located \program files\Common Files\System\Ado\msADOX.dll

using ADOX;
Catalog cat = new Catalog();
strCreateDB += "Provider=Microsoft.Jet.OLEDB.4.0;";
strCreateDB += "Data Source=" + pstrDB + ";";
strCreateDB += "Jet OLEDB:Engine Type=5";
cat.Create(@"c:\test.mdb"1);

P> Hi, I am developing a c# windows .NET application. The application is
P> going to run on a standalone PC and use an access database. I have
P> figured out that I will need to create a project and add it to the
P> custom actions of the my setup project to create the database.
P>
P> How do I create the database and then add a table using C#? Also,
P> should I use an odbc data adapter, which I usually use with Access
P> and if so how do I register the new database I have just created from
P> my custom action project as an ODBC database.
P>
P> Any help would be greatly appreciated, I imagine the answer to this
P> question could help quite a lot of people who use Windows Apps/Access
P> for small projects and want to create an installer for them.
P>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Feb 8 '06 #2
On Wed, 8 Feb 2006 18:34:08 +0000 (UTC), Michael Nemtsev
<ne*****@msn.com> wrote:
Hello Paul,

Add reference to the COM lib "Microsoft ADO Ext 2.8 for DLL and security"
located \program files\Common Files\System\Ado\msADOX.dll

using ADOX;
Catalog cat = new Catalog();
strCreateDB += "Provider=Microsoft.Jet.OLEDB.4.0;";
strCreateDB += "Data Source=" + pstrDB + ";";
strCreateDB += "Jet OLEDB:Engine Type=5";
cat.Create(@"c:\test.mdb"1);

P> Hi, I am developing a c# windows .NET application. The application is
P> going to run on a standalone PC and use an access database. I have
P> figured out that I will need to create a project and add it to the
P> custom actions of the my setup project to create the database.
P>
P> How do I create the database and then add a table using C#? Also,
P> should I use an odbc data adapter, which I usually use with Access
P> and if so how do I register the new database I have just created from
P> my custom action project as an ODBC database.
P>
P> Any help would be greatly appreciated, I imagine the answer to this
P> question could help quite a lot of people who use Windows Apps/Access
P> for small projects and want to create an installer for them.
P>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche

Or reference DAO in your project and build the DB with DAO.

Or use a template database and copy it each time you create a new DB
and change it's name

Otis Mukinfus
http://www.otismukinfus.com
http://www.tomchilders.com
Feb 9 '06 #3
Otis Mukinfus wrote:
Or reference DAO in your project and build the DB with DAO.


I think we were supposed to stop using DAO about 5 years ago...
--
jc

Remove the -not from email
Feb 9 '06 #4
On Thu, 09 Feb 2006 09:37:10 GMT, Jeremy Collins
<jd********@ntlworld-not.com> wrote:
Otis Mukinfus wrote:
Or reference DAO in your project and build the DB with DAO.


I think we were supposed to stop using DAO about 5 years ago...


When did those idiots and crooks in Washington DC pass that law?

I have several tools in my tool box and use them all when I need them.
Saying we are supposed to stop using DAO is like saying we're supposed
to stop using arrays because were now have collections and lists.

If we follow your line of reasoning we can't use the first solution
suggested, because it looks like it ends up calling ADOX, which you
must believe we shouldn't use either.

Use the wrench that fits the nut you want to tighten or loosen, even
if it belonged to your grand-daddy.
Otis Mukinfus
http://www.otismukinfus.com
http://www.tomchilders.com
Feb 9 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: kackson | last post by:
Hi. I would like to access my database outside of my company. I read many documents but they are all pertaining to accessing the database via ASP or some form of web application. Is there no...
56
by: Raphi | last post by:
Hi, I've been using an Access application I wrote for an office with the front-end stored on all computers and the back-end on one of them serving as an Access file server. Now we're moving...
6
by: Frank Wilson | last post by:
Tom, It sounds to me like ASP, not ASP.NET is handling the request for WebForm1.aspx. This is most likely an IIS config issue that may have been caused by order of installation or...
4
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The...
1
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The...
7
by: Terry Holland | last post by:
I have just created my first asp.net application and I am ready to deploy. The solution consists of the following: A single asp.net assembly to be deployed to web server A number of vb.net...
1
by: goose28 | last post by:
Instructions for creating a silent install project in Visual Studio.NET 2003 for "All Users". 1) Create a default setup project for your application using Visual Studio (File/New/Setup and...
2
by: Gilberto | last post by:
Hello guys, i just started developing a database for my company which will help a department to build BILL OF MATERIALS (BOM) of different projects. The main idea is that FIRST the user will...
1
by: Claire | last post by:
Ive written a small string resource building utility that I send out to our translators. I have a setup project for each language we support, which picks out a group of 12 english resx files plus...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...

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.