Regedit return 值空
Regedit return value null
有人帮帮我。
为什么这段代码不能正常工作。
仍然 return 为空。
RegistryKey hklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
RegistryKey rk = hklm.OpenSubKey(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQLServer\SuperSocketNetLib\Tcp\IPAll",RegistryRights.ReadKey);
string valueName = "TcpPort";
您需要更换:
hklm.OpenSubKey(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQLServer\SuperSocketNetLib\Tcp\IPAll",RegistryRights.ReadKey);
和
hklm.OpenSubKey(@"SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQLServer\SuperSocketNetLib\Tcp\IPAll",RegistryRights.ReadKey);
有人帮帮我。 为什么这段代码不能正常工作。 仍然 return 为空。
RegistryKey hklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
RegistryKey rk = hklm.OpenSubKey(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQLServer\SuperSocketNetLib\Tcp\IPAll",RegistryRights.ReadKey);
string valueName = "TcpPort";
您需要更换:
hklm.OpenSubKey(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQLServer\SuperSocketNetLib\Tcp\IPAll",RegistryRights.ReadKey);
和
hklm.OpenSubKey(@"SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQLServer\SuperSocketNetLib\Tcp\IPAll",RegistryRights.ReadKey);