Click here to Skip to main content
14,773,364 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Everyone

I hope you help me because i'm stuck with a big problem of setup and deployment I have developped an application with vb 2010 and the database is designed with sql server express 2008 R2 and i try to find a best solution to my problem. My problem : I want to deploy my application on another machine so once it's installed the end user is to be able to connect a database and use it for updating data , delete, adding data ...etc so the connection string was my big problem because the target machine doesn't have sql server express 2008 installed and net framework 4 too .

If we assume that the target machine has sql server express 2008 installed ,how i can know the name of server , the name of instance running on that machibe...etc ?

Where to copy my database files (.mdf and .ldf) in my project application ? is it in output project : \BIN\DEBUG or where ? because i think my connection string depends on the path where these database files (.mdf and .ldf).

My connection string is in code of my application exactly in module ,i have declared it Public it look like this :

Public strcon as string="data source=.\SQLExpress,AttachDbFilename=|Datadirectory|MyDatabase.mdf;Integrated Security=True;User Instance=True" 

One more thing, I use setup and deployment of visual studio 2010

Please advise me on the best solution because it's been several weeks since I try but I'm lost and confused about the best solution.

Thanks in advance

1 solution

Hi. There are many ways to accomplish your task.
You could create custom dialog form wich will process data user enters and custom actions. You should set MS SQL Express dependancy and allow user to choose other than Express instances (if ones were installed already on target system) - Developer, Enterprise etc.
Also you could implement file dialog for database path exctraction.
Though I suggest you not to copy *.mdf files if possible. Try to create database script and implement its execution in custom action.

Please refer these links below for details... or google for something else :)
2. How to create custom dialog boxes using the Web Setup Project in Visual Studio 2010[^]
3. Custom Action in Visual Studio setup projects[^]

Good luck!

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