Click here to Skip to main content
15,792,340 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
im fresher in i need connect Remote sql server database through the internet . anyone guide me pls

thanks and regards
Member 9197016 25-Jan-14 1:27am    

Eventually i find solution to this problem:

that's first we need to configure client location Router settings. then open sql server tcp port( 1433 ) or Udp port (1434 ) in that location.

First thing:
client location Router settings:

Start->run->type cmd then press Enter
then dos prompt will open.

1) Now you can see dos prompt then type ipconfig - press Enter

Now your system ip,subnet and gateway information will display on your command prompt.
take your gate way ip ( for example :
2) goto your system browser

type your gateway ip in browser address bar
Now your system will ask router username and password.
then enter your correct user name and password. then ur router home page will open in your browser.

Now you can see exactly 6 or 7 links, in that link click management link then sub links will list out lik LAN,WAN,NAT and so on.
now click NAT link then give your System ip and Sql server port then click save& apply...

this information for Bsnl router only

then check in command prompt with below command:

telnet client <> public ip <> 1433

if this command give blank black screen its connected with remote system if not otherwise

My connection string format:

        <add name="dbconnection" connectionString="Data Source=tcp: remote location ip (public ip address),1433;Initial Catalog=Education;uid=sa;pwd=123" providerName="System.Data.SqlClient"/>

that's it!!!

Share this answer
Prasad_Kulkarni 8-Aug-12 7:42am    
Good work! +5!
kokottt 24-Oct-16 3:13am    
Would you please Describe these steps through A video
This has nothing to do with C# or .NET. It has to do with the network your SQL Server is running on, being connected to the internet.

I told you that, two days ago. What did you do for the last two days ?
Share this answer
Sarrrva 3-Aug-12 1:47am    
yeah i agree with you sir,

this is my connection string

SqlConnection cn=new SqlConnection ("srever=;database=dbname;uid=sa;pwd=123");
is this right?
thanks and regards
AshishChaudha 3-Aug-12 2:02am    
SqlConnection cn=new SqlConnection ("server=;database=dbname;uid=sa;pwd=123");

Is above are your server details..??? In place of put your server IP Address, In place of dbname, put your server database name and put your userid and password of your server in place of uid and pwd...
Sarrrva 3-Aug-12 2:22am    
i tried this way Ashish


<<add name="dbconnection" connectionstring="Data
Source=PINNACLESERVER\SQLEXPRESS;database=RKT;uid=sa;pwd=123" providername="System.Data.SqlClient">><</add>>


AshishChaudha 3-Aug-12 3:06am    
Mark solution as your answer.. so that other can refer to the answer..

Christian Graus 3-Aug-12 2:24am    
Well, what he said is right, and what you posted is useless. So are you sure you tried with an IP that your server serves to the internet ? If you know you need to do that, why not debug that, instead of stopping doing what you need to ?
Its same as you connect local database. You have to use remote server credentials in your connection string.
Share this answer
Sarrrva 3-Aug-12 1:43am    
i need detailed explanation sir, i tried so many times but still didnt get any positive results
thanks and regards
[no name] 3-Aug-12 7:55am    
No one can give you "step by step" instructions. This is purely a network configuration issue. We cannot know how your network is setup. Hire a local IT consultant to come in and straighten out your hardware issue or google troubleshooting network connectivity issues.
Sharma Richa 3-Aug-12 1:49am    
there is no one to do your home work.
have you googled ?
Sarrrva 7-Aug-12 8:48am    
i can give solution to this problem Now......

Mr Sharma Richa
thanks and regards
Sharma Richa 7-Aug-12 9:27am    
thats great sarva.
Click on I've solved this myself! button and provide the solution.
and one more thing i am not Mr Richa, its Mrs Richa.
define it in your web.config file.
<br />
<connectionstrings><br />
  <add name="[Connstring name]" connectionstring="Data Source=[servername];Initial Catalog=[database name];User ID=[userID];Password=[password]"><br />
   providerName="System.Data.SqlClient" />  <br />

Share this answer
Sharma Richa 3-Aug-12 1:54am    
He know that it has to define in web.config
But he need exact solution for remote database connection.
See childish comments in solution1 and solution2.
AshishChaudha 3-Aug-12 2:03am    
You are right richa...this is the funniest question I seen in these few days..
Sarrrva 3-Aug-12 1:54am    
i also tried this way

it works fine IN my LAN
but not work outside the lan
Christian Graus 3-Aug-12 1:57am    
That's because that's a local IP address. Is the computer that your SQL Server is on broadcasting to the internet ? Being able to browse the web is not the same thing.
AshishChaudha 3-Aug-12 1:57am    
could you please change credentials according to your server. The connection string you are showing is well and good for your local system. The same way you are working in Local system have to define for Server.
try Following links here you get detail Explanation about connectivity[^][^]

Hope it will Help U
Best Luck
Happy Coding :)
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