Click here to Skip to main content
15,884,933 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
Hi,

i want to access the database from another system (like client-server ).
i am using the following string at this time.(which is used in local system)

string connstr = @"Server=.\SQLEXPRESS ;Initial Catalog=DB;Integrated Security=True; Max Pool Size=100";


Please tell me what is the change will be added in my string.
Posted
Comments
[no name] 17-Sep-13 10:00am    
www.connectionstrings.com
Zubair Alie 17-Sep-13 10:04am    
Check Fredrik's solution. + NAME_OF_YOUR_SERVER_HERE = the IP or the URI. i.e. 192.158.0.123

Change it to;
string connstr = @"Server=NAME_OF_YOUR_SERVER_HERE\SQLEXPRESS ;Initial Catalog=DB;Integrated Security=True; Max Pool Size=100";


Hope this helps,
Fredrik
 
Share this answer
 
As Fredrik has stated, you replace the . before the \SQLEXPRESS with the name of the server you are connecting to. The . is a shorthand way of referring to your local machine. Note
 
Share this answer
 
try
string con = @"Server=serverip(127.0.0.1)(for local)\SQLEXPRESS ;Initial Catalog=DB;Integrated Security=True; Max Pool Size=100";
 
Share this answer
 
 
Share this answer
 
Comments
indiancodinglove 18-Sep-13 0:29am    
thanks all
its working but one problem.

when i am off the firewall option then the connectivity is working fine data can be retrieve from the database if firewall option on (adding with port tcp=1433) then it show an error.

"An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)"
V.Lorz 18-Sep-13 1:11am    
Perhaps that depends on more firewall configuration parameters, not only the port and where it is located (in the local computer that attemps the connection, the remote server, or one physical device in between.
indiancodinglove 18-Sep-13 1:40am    
remote server
V.Lorz 18-Sep-13 2:04am    
Ok, if it already works with the firewall disabled then you have most of your work done and something to play with.
indiancodinglove 18-Sep-13 2:15am    
only for my knowledge. i think why it is not working with the firewall option enable so i am trying.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900