0

I have created a Windows Forms desktop application using Visual Studio 2019. I also created a database using SQL Server Management Studio. I connected the database with my application with connection string

"Data Source=CYBERCELL\\SQLEXPRESS;Initial Catalog=Details;Integrated Security=True;"

The application is running without any error. I published this application using Visual Studio 2019 publish wizard and installed in another computer. But I can't understand how to use and connect the database with the application in that system.

I am looking to install SQL Server in every computer. But if I install SQL Server, the server name will be different.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Sooraj
  • 9
  • 1
  • 3
  • If you're locally installing SQL Server Express on each individual computer, you could use `.\SQLEXPRESS` (or `(local)\SQLEXPRESS`) as your server/instance name - this is the same on every computer – marc_s Jan 08 '22 at 07:47
  • 1
    You've asked this before. The previous question has open queries in the comments from people who were willing to help. Next time, instead of asking the same question again, engage with people asking you questions s; they aren't asking to be annoying, they're asking because you didn't put enough info in the question first time to enable it to be answered – Caius Jard Jan 08 '22 at 08:52
  • 1
    Does this answer your question? [C# Windows Form Application With SQL Server database deployment](https://stackoverflow.com/questions/70515583/c-sharp-windows-form-application-with-sql-server-database-deployment) Do *not* repost the same question again, it annoys everyone and is severely frowned on. Instead improve your original question by answering basic information requested in the comments – Charlieface Jan 08 '22 at 20:53

2 Answers2

0

If you're locally installing SQL Server Express on each individual computer, you could use

.\SQLEXPRESS

or

(local)\SQLEXPRESS

as your server/instance name - this is the same on every computer. The dot . or (local) (in parenthesis) refers to the local computer, and SQLEXPRESS is the default instance name for any SQL Server Express installation.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
0

I once stuck with this same scenario... and this is how I solved the problem,

You don't have to install SSMS or SQL server on any of your client's pc, if you follow these steps

  1. You have to create a localDB on your application and make sure the application will connect to that localDB.(if you don't know how to connect to local db, here => Connect to LocalDB. And make sure to create tables and procedures as same as your previous database.

  2. Follow this answer(ticked) with code(connection string)

  3. After this, you have to install Advanced Installer to create an installer for your application (the best choice I ever chose).

  4. Then Follow this to create an installer where you make sure to add a prerequisite of localDB (say localdb 2019) installer of your current version.

  5. This makes your application run on any pc and only requires localdb as a prerequisite to be installed which also comes with the installer.

  6. Make sure to leave a message not to delete localdb on the application installed location.

Opus Corpus
  • 115
  • 1
  • 8