C# .NET - How to access sql database through LAN

Asked By happy happy on 01-Jan-10 03:25 AM
Hi All,

I have developed windows application,Now I want to use it through LAN,so I want to access my sql database from my server through lan.I have given my sql server(server)credentials as my connection string.still its not working...should i change any settings in sql server.its urgent,pls help me.
Jonathan VH replied to happy happy on 01-Jan-10 09:48 AM

What version and edition of SQL Server? Some editions have remote connections disabled by default and would need to have that setting changed using Surface Area Configuration tool (SQL Server 2005) or SQL Server Configuration Manager (SQL Server 2008).

What is the complete error you are getting, and when do you get the error?

What is the connection string you are using? Does it work when used from the server but not from another computer on the LAN?

And yes, - [)ia6l0 iii replied to happy happy on 01-Jan-10 02:23 PM

to enable remote connections in 2005, you would do the following. 
Choose the Surface configuration and then do the following steps:
a) Open the node that reads "SS2005", 
b) Click on "Database Engine"
c) You should see an option that reads "Remote connections"
d) Click on "Remote connections" and choose the "Local and Remote connections"

And in 2008, you would go to SQL Server Configuration Manager - SQL Server Network Configuration,  and then
choose the Protocols for the appropriate server. Enable the TCP/IP protocol. Restart the SQL Server service.

On the same note, your connection string should look like:
    <add name="myConnectionString";Integrated Security=true
       connectionString="Data Source=server database=Northwind;" />

The connection string can be found in your web configuration file. (web.config)

Hope it helps.