Windows API call "RegGetValueW" returned error code: 0
Asked Answered
G

3

22

I am getting Windows API Call Error Code : 0

I have installed SSMS 2018 and was trying to find out if I have any other versions installed. For that I ran sqllocaldb versions in CMD but got the following message:

Windows API call "RegGetValueW" returned error code: 0.

When I checked manually (via Control Panel), I saw that I have 2015 and 2016 versions installed. So Why it are they not showing in CMD.

I tried to find other solutions but found nothing that made sense to me.

Goldagoldarina answered 25/6, 2019 at 19:16 Comment(1)
S
34

This post helped me: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/1257bf26-6ab0-416d-bf26-34f128f42248/sql-2016-sp1-sqllocaldb-versions-errors-with-quotwindows-api-call-quotreggetvaluewquot?forum=sqlexpress

In registry change catalog name in

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server Local DB\Installed Versions

to match the version listed in

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL13E.LOCALDB\MSSQLServer\CurrentVersion

I my case I had to change from 13.0 to 13.1.

Scab answered 7/10, 2019 at 18:49 Comment(1)
This also happens with Visual Studio 2019 (for me it's version 16.3.3) with a workload that includes SSDT/localDB. I logged a bug report here: developercommunity.visualstudio.com/content/problem/809670/…Trihydric
M
22

This is still an issue sometimes in 2020. daniell89's answer is correct, here is an image further explaining the fix.

enter image description here

Maddening answered 24/4, 2020 at 7:23 Comment(0)
P
4

I see that the answers above are correct. However, I would like to share how to fix it step by step.

First, open the Registry Editor. To do it make a combination on the keyboard: Windows + R and then type regedit and hit OK. The Registry Editor should appear.

Then find the installed current version under this path:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL13E.LOCALDB \MSSQLServer\CurrentVersion

In my case it was 13.1.4001.0

Then go to Local DB registry:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server Local DB\Installed Versions

There you should have listed folders named as versions. I had there a folder 13.0 which I have changed to 13.1.

After the renamed of the folder the command SQLLocalDB versions works perfectly.

Pulmonate answered 9/3, 2022 at 14:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.