Sql Connection From Local C# Application to Another Computer RRS feed

  • Question

  • hi guys i build an application and build a connection to my local sql databse on my computer. Its working fine 

    well i want to know is there any way to connect my server Database from my local computer using c# application ??

    i have a server which i can only connect by web application but i want to connect that server database using my local c# application with the help of internet ....

    i have server ip address and and tried to connect using this connection string ...

    Data Source=,1433;Network Library=DBMSSOCN;
    Initial Catalog
    =myDataBase;User ID=myUsername;Password=myPassword;

    its not working any help please ???????

    Saturday, October 19, 2019 1:47 PM

All replies

  • You can connect to a remote SQL Server instance from your local computer if there is a network path to the machine on which SQL Server is running on. A simple case where this works is when you have two computers at home, with the client running on one machine, and the client running on the other. Equally simple is the situation when you have an SQL Server instance in the same corporate network as your workstation/laptop. (Unless the network admin have made some special arrangements.)

    I don't know the specifics in your case, but you talk about a web applicaiton and connecting over the internet. In this case, it depends on whether the SQL Server machine is exposed directly to the internet, and you would have to talk with the admin of the site to get information. However, it is definitely not best practice to expose SQL Server directly on the internet, so if the admin is the least security-minded this is not the case. Howewver, the site owner may offer a VPN connection, but, again, you will need to ask them.

    Erland Sommarskog, SQL Server MVP,

    Saturday, October 19, 2019 5:05 PM