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 and installed in another computer. But I can't understand how to use and connect the database with the application in that system. Iam looking to install SQL Server in every computer.

Sooraj
  • 9
  • 1
  • 3
  • 1
    Are you installing SQL Server on the new computer? Or trying to access SQL Server via the network? – Dale K Dec 29 '21 at 06:07
  • 2
    I have the same question as Dale; are you going to install SQLServer on every computer that you install the app on and each app on each computer uses its own local database... or are you wanting it to be that one computer on the network will have the database on it and all the other computers the app is installed on will use that one central database? – Caius Jard Dec 29 '21 at 06:12
  • Am installing SQL Server on every computer. – Sooraj Dec 29 '21 at 07:55
  • Is `CYBERCELL` the name of the server you are going to use? Can all machines access it (probably not if it's not on the same LAN)? Has it been configured for remote access? – Charlieface Dec 29 '21 at 12:11
  • I think [answer](https://stackoverflow.com/questions/70630329/connect-windows-forms-application-with-sql-server-express) is on your another question – Opus Corpus Jan 08 '22 at 14:24

1 Answers1

0

1- Each computer has a different data source, so in the first step, you must correct the data source of the new computer in the connection string.

2- In the second step, it is necessary to mention this point, when you install SQL Server, be sure to set the connection type on both authentications, otherwise the value Integrated Security = True; will not work properly.

3- In the last step, you must create the database that you created in your system in the new system, which you can do by backup and restoring.

for set authentication , see this link : https://www.dundas.com/support/learning/documentation/installation/how-to-enable-sql-server-authentication

  • How can i give common connection string to work all system – Sooraj Dec 29 '21 at 09:38
  • You can design a program in which the connection information to the database is entered by the user and then the information is created in the Windows registry file, and then you can read the connection string information from the registry file. I think the following links can help you: [link](https://www.codeproject.com/Articles/3389/Read-write-and-delete-from-registry-with-C) also this link about same issue : [link](https://stackoverflow.com/questions/1551581/how-to-read-db-connection-string-from-system-registry) – Mohammad Sadegh Mazaheri Dec 29 '21 at 11:49