Marie Mirzazade
Marie Mirzazade

Reputation: 79

Is there anyway to connect to local SQL Server database from hosted website?

I create a website with a SQL Server database and put it on a host ...

I just want to know if there is a way that when I open my website on a special PC, I could connect to the PC's SQL Server database for reading and writing ...

Let me know if there is a special connection string for that !

Upvotes: 0

Views: 1510

Answers (1)

virender
virender

Reputation: 4647

You need to use server IP address and user id , password for connect to database.

Like

<add name="DefaultConnection" connectionString="Data Source=198.0.0.1;Initial Catalog=Database;user id=user1;password=[system];" providerName="System.Data.SqlClient" />

IP - 198.0.0.1 User id - user1 password - [system]

Note -

  1. When you accessing your database from other computer , windows authentication will not work.
  2. Set sql server authentication in sql server
  3. Allow remote connections to sql server
  4. Allow Sql server port into firewall

Then try.

Upvotes: 2

Related Questions