-1

I have written an UWP app for managing employees, timesheets etc.

How do I detect if SQL Server Express is installed and if not installed how do I setup SQL Server Express on the client computer? Is it possible to do it without running the exe file in 'fulltrust'?

I would also like to include the setup files in my app package with the configuration file to run a silent install on the client computer.

I have looked for a answer on many pages but could not find a real straight forward answer.

Some help here would be much appreciated.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Johan
  • 3
  • 3
  • If there were answers you didn't understand then quote the parts you dom't understand and cite the answers, then we can try to elaborate. – Thom A Aug 09 '20 at 21:52
  • Let's try just a little searching about [deploy database with application](https://www.google.com/search?q=deploy+sql+server+express+database+with+application&rlz=1C1CHBF_enUS727US727&oq=deploy+sql+server+express&aqs=chrome.0.0j69i57j0l5.5716j1j7&sourceid=chrome&ie=UTF-8) – SMor Aug 10 '20 at 12:27
  • Does this answer your question? [How to deploy application with sql server database on clients](https://stackoverflow.com/questions/32956142/how-to-deploy-application-with-sql-server-database-on-clients) – SMor Aug 10 '20 at 12:27

2 Answers2

0

when you have access to your client computer, you can run a check program in your setup process via checking if MS SQL Server Express registry key exists or not. If it exists, then it is installed.

Read this doc from Microsoft, there is a code snippet in the doc you can use:

https://learn.microsoft.com/en-us/previous-versions/sql/sql-server-2005/express-administrator/bb264562(v=sql.90)?redirectedfrom=MSDN

stanleywxc
  • 28
  • 1
-2

What do you mean by 'auto-detect' MS SQL Server Express installed'? Not sure what's your use case here.

Normally, you can not auto detect database to use since in many cases there could be multiple databases installed in the environment, and you don't know which one is the right one you are going to use. You have to know which database you are going to use first.

However, if you insist to detect database, you can do the port scan in your network which is really not a good idea.

So guess maybe your use case is unique.

stanleywxc
  • 28
  • 1
  • I have to detect if MS SQL Server is installed on the client computer and then install it if it is not not installed. My app uses MS SQL Express. Sqlite is not a option. – Johan Aug 10 '20 at 06:33
  • Thanks you pointed me in the right direction. The problem now is the correct keys is not read to check the installation using (RegistryKey Key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Microsoft SQL Server\")) It do not return all the keys – Johan Aug 12 '20 at 17:02