Click here to Skip to main content
15,903,388 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
If a Clint is in other city and server is other city then what will be connection string
This is connection string fro local machine.
<pre lang="vb">
Public Function connection() As SqlConnection

con = New SqlConnection(&quot;server=(local);database=info;uid=sa;pwd=&quot;)
Return con
End Function
Please any one tell me what will be there CONNECTION string
I think it seems like
Public Function connnection() As SqlConnection
con = New SqlConnection(&quot;server=ipaddress/192.168.1.1;database=info;uid=sa;pwd=&quot;)
Return con
End Function</pre>
If he is using dsl internet connection so how I can know his ip and how I connect with his computer?
Posted
Updated 11-Nov-10 20:20pm
v2

First you need to set-up Port Forwarding in your DSL modem and any routers you have to forward any requests from the internet on port 1433 to your computer, also open port 1433 in any firewalls, then you need to give Clint your public IP address, NOT 192.168.1.1 it is assigned by your ISP, which may change if your modem resets, if your ISP doesn't assign static addresses.
Connection string becomes;
Data Source=Your Public IP Address,1433;Network Library=DBMSSOCN;Initial Catalog=YouDataBase;User ID=myUsername;Password=myPassword;

This assumes that Clint needs to connect to the database on your computer, the computer with the database does not initiate the connection.
 
Share this answer
 
Some advice
1. Don’t expose your SQL Server
2. Use some other option to access data like web service.
3. You need a static IP at your server end.
 
Share this answer
 

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