Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hello

I have a Visual Studio 2010 project that works with a database. It's simple enough, using the form it adds contact info to the db and can read the info from the db. That's all nice and peachy, as long as it's on my laptop.

What should I do to make it 'readable' on other machines?
Do I somehow export the database with the project (I thought it would do this automatically as I added the db within VS itself), or do I have to change the connection string?

Thank you!
Posted

you have to create database instance on that perticulkar PC when you install your setup for that you have to add prerequisite as sql instance in your setup then write code which will get connection string autometically which contains PC name & sql instance name

reffer following links
Add Prerequisites of .NET Framework in Visual Studio Setup Project[^]


http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/b32f7782-c905-4577-ab7c-a0827803eea3/[^]
 
Share this answer
 
Please take a look at this answer on StackOverflow: Deploy Visual Studio 2010 Database Project[^]

Yes, you can deploy from Visual Studio to different machines. You can also do it from the command line, using VSDBCMD. And you can create a WIX project to give a wizard for others to install it with.

If you can connect to the target database from your dev PC, you can deploy to it. To do this:

Select another Configuration from the Solution Configuration drop down. Normally, the Project will come with "Debug" and "Release" baked in. You can add another configuration to allow you to deploy to various targets by clicking "Configuration Manager."


Right-click your Project and select 'Properties', or simply double-click Properties under the project.
Click the Deploy tab. Notice that the Configuration: drop-down shows the same selected configuration as "active."
Change the Deploy Action to "Create a deployment script (.sql) and deploy to the database."
Next to Target Connection String, click "Edit" and use the dialog to create your deployment connection to the target database.
Fill in the Target database name, if different.
For each Deployment Configuration (e.g., Debug, Release, etc.), you will probably want a separate Deployment configuration file. If you click "New," you can create one for the current configuration. The new file will open, and you can check and uncheck important things about the deployment.


Note: If you check Always re-create the database, the script will DROP and CREATE your database. You will lose all your data on the target! Be careful what you select here. Most people leave that unchecked for a Production target. I check it for Development or Local because I want a fresh copy there.
Save your changes to the file and to Properties.
To deploy to the target, be sure to select the correct Configuration. Click Build/Deploy [My Database Name]. You probably should experiment with this so you are familiar with how it works before trying it on a live environment.
Good practices: build a similar environment to production ("Staging") and deploy there first, to test the deployment, and always back up the database before deploying, in case something goes wrong.

For more info, please see:

Working with Database Projects (http://msdn.microsoft.com/en-us/library/xee70aty.aspx)

Walkthrough: Put an Existing Database Schema Under Version Control (http://msdn.microsoft.com/en-us/library/aa833194.aspx)

Visual Studio 2010 SQL Server Database Projects (http://msdn.microsoft.com/en-us/library/ff678491.aspx)
 
Share this answer
 
v4
That depends!

What it primarily depends on is which database system you used: if you used SQL server or MySQL for example, then the destination machine either needs access to an server instance, or someone will have to install the whole (huge) DB management system on the machine, or a machine it has access to via a network.

If you used SQLite or SqlCE on the other hand, then you just need to include the file, and the relevant DLLs instead.

If you did use SQL server of MySQL and this is a single user database, then I would strongly recommend changing your app to use SQLite or SqlCE instead.
 
Share this answer
 

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