6
I developed an application in C#, which uses SQL Server Express 2012. No development everything went well with access to the database because it is all on the same machine ( utilizo o localhost
).
Now I have to install the application on other computers. The database is local. Which version of SQL do I have to install on these computers and what is the easiest way to do it since I won’t be the one to install it? Will localDB be an option?
Connection string - "Data Source=localhost ; Initial Catalog = scalnet ; Integrated Security=SSPI; Trusted_Connection=Yes";
On the computer I’m developing the app I’m 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"
On the other machine no longer seems that error but when I do the Store..
Now an error appears when I try to re-store 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");
}
Hello. The client install version will still be SQL Server Express 2012. You can always choose to do the installation without the
Management Tools
, in order to reduce the size of the installation. There is some restriction on the installation to be asking the question?– Omni
The only restriction would be even the space to occupy and also the operating system of the machine where it will be installed because I know that in win Xp the server 2012 is not compatible. Would have to install the 2008 R2..
– losorio
In that case you will need to ensure that the database code is compatible with 2008 R2. You mentioned C#, please note that Windows XP only supports up to . Net Framework 4.0 .
– Omni
Yes, I paid attention to that. Thank you. By suggesting not to install Management Tools, the customer has no direct access to the right database? The software uses SQL Server but the client can’t say "edit". That’s it?
– losorio
Yes, you will be unable to use the SQL editor to edit the database. However, this should be checked with accounts and not by default with tools, as it is possible that the client will later install the
Management Tools
.– Omni
But if the client has access to an Administrator user on his computer he can enter SQL by Windows authentication and so change whatever he wants. Ensure that the user will not change anything in the database is only possible if the client does not have access to the server on which SQL is installed.
– Marciano.Andrade
@Andrade the initial "solution" to the Administrator problem is not having the
Management Tools
. But as I said, the ideal solution is to set uplogins
in order to ensure that only the right people can edit the data. You can, for example, disable thelogin
with Windows credentials and use only the accountsa
.– Omni
OK. I already installed SQL SERVER EXPRESS 2012 on a test machine with Win7. The error appears when I try to run the program "A network-Related or instance-specific error occurred while establishing a connectionto SQL SERVER...." Any idea ??
– losorio
Don’t forget to turn on the SQL Server protocols in Sql Server Configuration Manager (put Enabled TCP/IP and Named Pipes). Take a look at this link
– Omni
I already have Enabled TCP/IP and Named Pipes a Enabled, but the error remains..." A network-Related or instance-specific error occurred while establishing a Connection to SQL SERVER .... error:40 - Could not open a Connection to Sql Server
– losorio
When do you get the error? How much do you try to call by
Management Tools
? Or by your program? What Connection string are you using? The SQL server is running?– Omni
Probably this problem should be easy to solve, but as it is my first time installing software on other machines, I really need help.. I will Update the question with more data , but see if you can help me ! Thanks for the availability.
– losorio
I solved the problem by installing localDB on other computers and changing the Connection string.
– losorio