Paul S
Paul S

Reputation: 81

SQL server remote access from and C# windows application

I have installed SQL Server 2008 R2 on my server and a C# application on Network Drive.

When I am running this application on server, it is working fine. But the problem occurs when I am running the application from client machines.

It does not connect to the server. I get the following error

Network related specific error..

Can anyone give me any solution ?

Connection string used:

<connectionStrings> 
    <add name="Truly_Paste_Solution.Win.Properties.Settings.TrulyDBAConnectionString" 
         connectionString="Data Source=.\sqlexpress;Initial Catalog=TrulyDB;Integrated Security=True;Pooling=False" 
         providerName="System.Data.SqlClient"/> 
</connectionStrings> 

Upvotes: 0

Views: 1124

Answers (2)

NeedAnswers
NeedAnswers

Reputation: 1435

What's your connection string ? Did you connect the SQL Server by IP ? Is there any firewall or Rules on your Server ?

Assuming your Server Lan IP address is 192.169.1.199 and your are running on MSSQL Server, so your connection string should be like :

Data Source=192.168.1.199;Initial Catalog=somedatabase;uid=yourid;pwd=yourpassword

Read about how to enable TCP/IP protocol connection here

Upvotes: 1

Typist
Typist

Reputation: 1474

There are different possible causes to get that kind of error -

  • Make sure your server's firewall settings allow remote host to connect
  • Make sure are connecting to the correct port of SQL Server which can be specified in the conecttiuon string
  • Make sure you have SQL or Mixed mode authentication enabled depending upon what scheme you use.

more things to check

Upvotes: 0

Related Questions