0

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 !

4
  • 1
    No, there is no magical way of connecting to a SQL Server - you just need to specify the server and database in your connection string - no matter where and how you want to connect to it ... Commented Jan 21, 2015 at 6:23
  • so.. I couldn't connect local DB ? yeah? Commented Jan 21, 2015 at 6:31
  • You need to specify in the connection string the address of the computer serving your database. Commented Jan 21, 2015 at 6:36
  • You mean that I need a valid IP for my PC ? yeah? Commented Jan 21, 2015 at 6:43

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.