0

I have problem when connecting to the database when I install my program on another machine.

In my program, I connect database with this connection string:

@"Data Source=Lee-PC;Initial Catalog=CoffeeManagement;Integrated Security=True";

I realize that on another PC, it will not be Lee-PC for data source, and I can't connect to SQL Server with that link. Please help me know how I can fix it.

Dale K
  • 25,246
  • 15
  • 42
  • 71
Ngo Hoang
  • 17
  • 4

1 Answers1

0

Follow up below threads How to run desktop application using SQL Server database on other computer connected with LAN

https://learn.microsoft.com/en-us/sql/relational-databases/lesson-2-connecting-from-another-computer?view=sql-server-ver15

Rajanikant Hawaldar
  • 314
  • 1
  • 5
  • 12
  • Thanks for your help. But it's not solve my problem. I create database on user's machine .And when I run my program on that machine. It will connect on user's database. That maybe JOHN-PC not Lee-PC – Ngo Hoang Apr 25 '20 at 03:43
  • 1
    @NgoHoang, you can specify "." instead of "JOHN-PC" or "Lee-PC" to connect to the local default instance. – Dan Guzman Apr 25 '20 at 03:45
  • @DanGuzman It's work for me. Thank you very much – Ngo Hoang Apr 25 '20 at 04:17
  • Please don't provide link only answers. Answers should be stand alone only using links for reference. – Dale K Apr 25 '20 at 06:19