Filepath for database in application - sql

I have a SQL database on the server and I want to import it to Visual Studio. I executed the script and a copy of the database was created in VS. Now what I want is to include the Database in to the project folder and I want to know the path of the Database relative to the application.
Also what should I do so that the installation file includes the database as well.
I am working in .NET WPF

Related

Multiple executable files in one setup using vb.net 2005 windows application

Kindly help me in creating one setup for multiple .exe files....
1)I have 36 .exe file & which needs to be executed in one setup, the project created in VS 2005 using vb.net & is a windows application
2) We need to restore a database during installation process.
3) We also need to set ODBC connection settings during the installation process
Thanks

Visual Basic .Net Application Deployment

I have designed an Application tracking details and I have deployed it. The records are updating the way I need. I want the same application to be used in other three different systems which do not have MS Visual Studio. How can I do it ? Is it enough that I create a similar table in the path I have designed in the other systems and run the Application ?
The probably easiest way to deploy your project would be:
Copy & Paste the whole output from your bin folder to the other machine and make sure the .net framework you used for your application is installed on this machine.
You can also create a Setup and Deployment Project
Open the Solution of your application
File -> Add -> New Project...
Other Project Types -> Setup and Deployment -> Visual Studio Installer -> Setup Project
In the File System Tab right-click on "Application Folder" -> Add -> Project Output and Select "Primary output" from your application project.
(More details about adding files to your setup project: How to: Add Items to a Deployment Project)
If you want to use a copy of the access database on each machine
As you're using an access database. You can mark the include you're access database to your project and set Build Action (in the Property Page) to Content.
Now in the same manner as before rightclick on "Application Folder" and add project output. Only this time select "Content Files" instead of "Primary Output"
Build the setup project and distribute the setup.exe or the .msi file.
If you want to access the same database from each machine
I would advise to store the application on a server which runs independent of your machine so that others can access the database also when your machine is not running.
Change your connectionstring, so that users from other machines are able to connect have a look at this site if you need help with connectionstrings.
As you won't be able to connect to the database with the absolute filepath from other machines, create a fileshare where everyone who should be able to connect has permissions to read/write.
Build the setup project and distribute the setup.exe or the .msi file.
Hope this helps so far.
Why should there be VB language on the target computer? Once compiled(published) you are out of the language environment and the program is in the machine language. In order to publish you have to go to "Build" and "Publish" after opening the program in the language environment. Publish it to a flash drive instead of the C drive. You can do that by selecting the "Browse" option. Once done you can take the flash drive around and install it on most computers that have the .Net files installed. In my experience most windows opss have them.
Just create an Installer after you have written and debugged your program. Install it plus your database on the server computer. If you intend to share the database and its a file-server database such as Ms Access, you will have to make sure that the folder is a shared folder.
Go to all the other computers on the network and repeat your installation. Make a Mapped drive on each computer and configure your database string to point to the mapped drive. If your database a server one like SQL Server, you will need to configure your database access string to point to the Server like so:
\Syl-PC\SQLEXpress.MydatabaseName
I assume that you are familiar with the complete syntax for connecting to databases from Visual Basic using a database provider such as Ole db or the SQL Server Provider.

How to use SQL Server 2008 Database project in installation time

I have created SQL Server 2008 Database project using visual studio 2010. after build and deploy this project i saw dbschema file that contain SQL queries that i use to create my database inside the XML tags. And there is another .sql file(This file also contain that sql queries. but there is no XML tags)
In this 2 files i want to know what is the file that i can use to create database in installation time and how to execute that file in installation time.
I found some details from http://msmvps.com/blogs/deborahk/archive/2010/05/02/vs-2010-database-project-an-introduction.aspx
Hope you guys can help me to get some solution.
To deploy the database project you just need to .dbschema file.
If your database is composed of multiple .dbschema then you have to deploy using the manifest.
The tool you need is vsdbcmd.exe in VS 2010. It works with SQL 2008. It does not work in SQL 2012.
Check out the following link on how to do it.
http://msdn.microsoft.com/en-us/library/dd193283.aspx

How to determine where Load Test results are saved in Visual Studio 2010?

I'm running some load tests using Visual Studio 2010. I haven't been able to figure out how to set where the test results are saved, and it seems that I have no test results to browse once the test runs.
I have the general idea that you're supposed to supply a SQL connection string specifying a SQL server with some tables set up on it.
Where do I set the connection string for local test runs? Is it possible to configure VS2k10 to save my test results to a file locally?
Please note that local SQL databases such as SQL Express are specifically forbidden in my environment.
If you find yourself in a situation where you didn't setup the database to store the test results from the VS 2010 Load Tester, the following will help.
The default install of VS 2010, won't have the Microsoft Visual Studio Test Controller 2010 tool.
To create the necessary tables to store the test results, all you need to do is run the loadtestresultsrepository.sql script against your database.
You'll find this script at:
x86 - C:\Program Files\Microsoft Visual Studio 10\Common7\IDE
x64 - C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE
Taken from:
MSDN: How to: Create a Load Test Results Repository Using SQL
Visual Studio strictly requires SQL Server for the load test store. If you don't have a SQL Server database, you cannot save test run data. All you can do is browse the result immediately after a test run, and perhaps copy-and-paste the test details into Excel. After you close the result, it's gone for good.
However, the database does not have to be on your local machine. Is there any chance you can get access to SQL Server somewhere else on your network?
You have to run "Microsoft Visual Studio Test Controller 2010 Configuration Tool" (found in Visual Studio start menu folder) to configure the database before use.
Setting the connection string is done in Test (menu) > Manage Test Controllers. This dialog allows you to select the Controller (or 'Local - No controller' for local tests) and also allows you to set the connection string to the load test results store.

Visual Studio 2010 Database Project Installer / Install script

I have been using a database project in visual studio 2010 to create a database. Visual Studio makes this process really easy to deploy the database and deploy updates. The issue I have is how I can get visual studio to create a script that will build the database that I can use on a QA or production system.
I thought that building the project would create a SQL file that did this but this does not seem to be true. Can someone please advise on how I can do this or what simple step I am clearly missing.
As strange as it may sound, Visual Studio does not create a SQL file to deploy your database when you perform a Build.
Instead, this occurs at Deploy time. The reason behind this lies in the way that Visual Studio makes changes to the database that you're deploying to: in order to change your database, it must first compare the project model (as defined in the files contained within the .dbproj) with that of the existing database schema to determine what changes you have made since the database was last deployed.
You then have the choice of manually executing the SQL script produced using the SQLCMD command-line utility (or through SSMS in SQLCMD mode), or alternately you can configure your Visual Studio Database Project to execute the script if you specify the following Deploy Action in project settings:
Generate a deploy script (.sql) and deploy to the database
Note that you will need to provide a connection string in project settings so VS knows where to deploy to.
When you get to the stage where you want to deploy to a QA or PROD environment, you have a couple of options:
Deploy directly within Visual Studio. In addition to the standard Debug and Release configurations that you get when you first create your Database Project, you can also create your own configurations which you could use to deploy to your QA and PROD environments (i.e. potentially with a different connection string/target database name).
Deploy from a Build Server. Install Visual Studio on a separate machine and call MsBuild against your .dbproj/.sln file with the Build and Deploy targets specified along with the appropriate connection properties.
Doug Rathbone has written a great blog post on subject if you want to learn more:
http://www.diaryofaninja.com/blog/2011/06/23/compare-amp-update-database-schemas-right-within-your-ide--part-2-automation-with-teamcity