Conéctese a SQL Server que está instalado en la máquina del servidor

Here is the situation: I have written an application in C# using SQL Server as database. Application works fine on my system. My client wants me to install this application on his Client System (Computer) but he is demanding to install SQL Server on Server machine. They access server on client Computer by typing "dataserver" in run window. My question is how my application would be able to connect to SQL Server (which will be installed on Server)? Currently I am using this line of code to connect to SQL Server (when database is in the same machine):

conn.ConnectionString = "Data Source=" + DataSource + "Initial Catalog=" + DB + "Trusted_Connection = true;";
conn.Open();

Kindly explain your answer as much as possible, thanks.

preguntado el 10 de marzo de 12 a las 07:03

That line won't work - needs a "; " before "Initial Catalog"; personally I'd just SqlConnectionStringBuilder -

1 Respuestas

what is the value of "DataSource"? change it to the remote server name and sql server instance name, then make sure the firewall (if there is one) on server permits connection to sql server, usually port 1433.

respondido 10 mar '12, 08:03

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.