0

I am trying to create setup file for my desktop application. I am using SQL Server Express as database and c# as programming language. I searched about creating the setup file but i am having some doubts... I have written the code to connect to the database in a class and called it wherever it is needed.

the code for creating connection is..

class dbConnection
{
    SqlConnection con;

    public SqlConnection doConnection()
    {

        try
        {
            String str = "Data Source=Basu-Pc\\SQL;Initial Catalog=PhoenixIS;Integrated Security=True;Pooling=False";
            con = new SqlConnection(str);
            con.Open();

        }
        catch (Exception exc)
        {

            MessageBox.Show(exc.Message);
        }
        return con;
    }
}

I call this class where ever I need it....and now I have some questions:

  1. how do I modify the connection string in order to deploy it to other system?
  2. how do I deploy sql express along with the system with hassle?

please help me get answer to my questions...

Adam
  • 15,537
  • 2
  • 42
  • 63
shunilkarki
  • 85
  • 2
  • 3
  • 17

1 Answers1

0

You can create a setup project as in this link:

create setup project step by step

About the sql connection string, you just need to create a .ini file and read that file in your program as in this link.

If you want to deploy sql express, just add the db file as resource in setup project.

HTH.

Community
  • 1
  • 1
Thinhbk
  • 2,194
  • 1
  • 23
  • 34