deploy a database application?

Ugojallas

Member
Joined
Apr 5, 2012
Messages
12
Programming Experience
Beginner
pls how can i deploy a database application with microsoft access using visual studio 2010
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
3,141
Location
Sydney, Australia
Programming Experience
10+
The fact that it's a database application using Access is fairly irrelevant because it doesn't affect how the application is deployed. So that begs the question: do you know how to deploy an application without a database? You have two choices in VS: you can publish your project to create a ClickOnce installer or you can add a Setup project to your solution. There's information about both in the MSDN Library so you should do some reading on the subject and then post back with specific questions. Note that C# Express only supports ClickOnce.

clickonce deployment - MSDN Search
setup project - MSDN Search
 

Ugojallas

Member
Joined
Apr 5, 2012
Messages
12
Programming Experience
Beginner
yes i know how to deploy without software. after i deploy the application it showed me error message that it can't find the microsoft access file in a particular location.so what am asking is how do i include the file into the application
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
3,141
Location
Sydney, Australia
Programming Experience
10+
If by "deploy without software" you mean what is commonly termed XCOPY deployment, i.e. you simply copy the files onto the user's machine using Windows Explorer, then you simply copy the Access data file that way too. If the application couldn't find the data file in the location it looked at then either:

1. you didn't deploy the data file; or
2. you deployed the data file to the wrong place; or
3. the application is looking for the data file in the wrong place.

Which is it?
 

Ugojallas

Member
Joined
Apr 5, 2012
Messages
12
Programming Experience
Beginner
the application is looking for the data file in the wrong place
 

Ugojallas

Member
Joined
Apr 5, 2012
Messages
12
Programming Experience
Beginner
pls how can i send you the application to you so you look at it pls.(thanks for your time and your guide)
 

Ugojallas

Member
Joined
Apr 5, 2012
Messages
12
Programming Experience
Beginner
i don't have connection string.i use add New data source from data menu in visual studio
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
3,141
Location
Sydney, Australia
Programming Experience
10+
You do have a connection string. If you didn't then you wouldn't be able to connect at all. The Data Source wizard creates the connection string for you and offers to display it to you. It also asks you whether you want it stored in the config file, which it is by default. Unless you unchecked that box, you can find your connection string in the config file, as well as on the Settings page of the project properties.
 

Ugojallas

Member
Joined
Apr 5, 2012
Messages
12
Programming Experience
Beginner
<add name="WindowsFormsApplication1.Properties.Settings.Computer_EngineerConnectionString"
connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source="C:\Users\jallasSQL\Documents\Computer Engineer.accdb""
providerName="System.Data.OleDb" /> this is my connection string
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
3,141
Location
Sydney, Australia
Programming Experience
10+
This is your conection string:
Provider=Microsoft.ACE.OLEDB.12. 0;Data Source="C:\Users\jallasSQL\Documents\Computer Engineer.accdb"
So, presumably that is the folder that contains the data file on your own development machine. The reason that the connection string is placed in the config file is specifically so that it can be edited after deployment in case the the database is in a different location. The user needs to edit the connection string to use the path of the data file on their machine.

The alternative is to use a location and connection string that will work on all systems. The way local data files are usually handled is to add the file to the project, so that the original is in the source folder with all the other source files, and then let the IDE copy it to the output folder when you build. That has several advantages. First, it means that you can use |DataDirectory| for the folder path in the connection string and then it will work without modification on all systems. Second, it means that your source database is not polluted with test data so each user receives it in pristine condition.
 
Top Bottom