Installing SQL Server on the client

6

I developed a C # application that uses SQL Server Express 2012. In development everything went well with database access because everything is on the same machine (I use localhost ).

Now I have to install the application on other computers. The database is local. What version of SQL do I have to install on these computers and what is the easiest way to do it since I will not be installing it? Will localDB be an option?
Connection string - "Data Source=localhost ; Initial Catalog = scalnet ; Integrated Security=SSPI; Trusted_Connection=Yes";
On the computer I am developing the app I am using SQL Server 2012 (which has the server as localhost) Is this the problem? ..

EDIT :: I changed the connection string to "Data Source=.\SQLExpress; Initial Catalog = scalnet ; Integrated Security=SSPI; Trusted_Connection=Yes"
In the other machine it does not seem like that error anymore, but when I restore ... Now an error appears when I try to restore the database

 using (SqlConnection conexao = new SqlConnection(config))
             {
                 conexao.Open();
                 string sqlR = "ALTER DATABASE " + nomeDB + " SET SINGLE_USER WITH ROLLBACK IMMEDIATE; ";
                 sqlR += "USE master RESTORE DATABASE " + nomeDB + " FROM DISK = '" + restoreDB + "'WITH REPLACE;";
                 SqlCommand command = new SqlCommand(sqlR, conexao);
                 command.ExecuteNonQuery();
                 MessageBox.Show("Base de Dados Restaurada");
             }
    
asked by anonymous 09.06.2014 / 12:33

1 answer

2

You can create an installer where, in addition to installing your application, it also installs SQL Express 2012 on the user's workstation.

You can also create a bat file to perform an unattended installation of SQL Server.

    
22.07.2014 / 13:25