0

In my application i have database connection
but i dont know how to attach my database with application

Front End : C#.Net
Back End : SQL server 2005


I need to create a setup to run my application on another machine ....

4
Contributors
3
Replies
6
Views
6 Years
Discussion Span
Last Post by mono_jit23
2

This is a base example of using connection string, but it works:

static string connString = @"Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;";
        private YourMethod()
        {
            using (SqlConnection sqlConn = new SqlConnection(connString))
            {
                sqlConn.Open();
                //do inquieries:
                string sqlQuery = @"SELECT ... FROM ... WHERE";
            }
        }

Use your correc connection string!

Edited by Mitja Bonca: n/a

0

Just simply add your database in your setup project in order to include the database during installation.

0

Use dynamic connection string rather than hard code. Get your connection string from settings file all the time. then you can simply create your setup file and install into client machine. After installation just change the setting file as per the client info (You can find it in installation folder and then open it with any text editor).
For your Database just get a backup and restore it to client machine or make a script.... :(

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.