Click here to Skip to main content
15,943,077 members
Please Sign up or sign in to vote.
4.00/5 (3 votes)
See more: , +
I am developing a desktop application.The application contains back end database.
Let us say for example i created a table for employee in company(database name) database.(In SQL server 2005)
My application has an interface to store employee details.now i wanted to create single executable file
with my database and application.I wanted to install that application in clients mechine which have no internet.
now i wanted to know how to do that and what are the software needed at clients system.

My sources for the task is below:

Windows xp sp2(clients system)
My executable file(.exe file)--->(I am using SQL server 2005 and VS 2008 professional)
1.how to create this exe file which includes company database
2.what are the softwares needed at clients system in order to run this application successfully

if possible give me step by step guidelines.


[edit]Code block removed - only use <pre> tags for code fragments - OriginalGriff[/edit]
Posted
Updated 20-Jan-11 20:59pm
v3

If your client is to be standalone and needs an SQL2005 database, then you will have to install your software and SQL2005 (Express as a minimum) on his machine. SQL2005 cannot be used without the SQL server installed somewhere to access the database. You cannot embedd SQL2005 server into your application.

However, if you need an SQL database to be used by a single user, then look at SqlCE instead: it is SQL, but is fully contained within your application, no external software is needed. It is, however, single user only: Only one instance of any application can access it's database at a time.
 
Share this answer
 
Comments
krishna_goluguri 21-Jan-11 3:35am    
Thank u griff.ok i wanted to use that application in a single system.which have no internet or any other connections.i prepare to use SQL CE because u said that it can be embedded in my application.now i wanted to create single executable file how to do that
My application + My database + SQL CE = myapplication.exe
please help me
OriginalGriff 21-Jan-11 3:38am    
Big subject: way too big to answer in proper depth here.
Google is your friend, loads of tutorials, just pick the one that fits your situation: http://www.google.co.uk/search?aq=1&oq=VS+setup+project&sourceid=chrome&ie=UTF-8&q=vs+setup+project+tutorial
In addition to OriginalGriff

It’s not possible to attach a database inside your EXE file. Even if you add the database file in your application as a resource then it will be read only.
But one thing may solve your purpose.
1. Attach the database as resource in your application.
2. Copy it from the resource into local drive in first run of the application
3. Use the database from the local drive.

But I don’t know whether this will solve your purpose or not.
 
Share this answer
 
v2
If you want to put Access Data Base inside your C# application, then you should do this.
First of all create any Access data base like here "PirFahimDataBase". Now in your Visual Studio go to the menu and do this

1: Click Data
2: Add New Data Base
3: Click Next
4: Click New Connection
5: Now change the Data Source by clicking Change and select Microsoft Access data base files
6: Click Browse for selecting your created data base

Now take inside in your project. You will have an access data base file in your project. After all that go to your .cs file and give a path to your data base connection string

System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection();
conn.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;" +
@"Data source=PirFahimDataBase.accdb";

Here, lets give an attention you have no extra path for your "Data Source" , because your Access Data Base file is in your project now. So just put the name of your Data Base File.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900