472,805 Members | 880 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,805 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 3354
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.