0
서비스를 설치할 때 새 시스템 DSN 항목을 만들려고합니다. TRegistry.OpenKey 및 TRegistry.WriteString을 통해 레지스트리에 쓰려고 시도했지만 값을 쓰지는 않았습니다. 내가 쓰고있는 세 개의 키 중 첫 번째 키가 잘 작동합니다.왜 내 레지스트리는 아무런 오류도보고하지 않지만 아무런 영향을주지 않습니까?
const
sODBCRegKeyLoc = '\SOFTWARE\ODBC\ODBC.INI\OBDC Data Sources';
sServerRegKeyLoc = '\SOFTWARE\ODBC\ODBC.INI\DSN Name';
rInstall := TRegistry.Create(KEY_READ or KEY_WRITE);
try
rInstall.RootKey := HKEY_LOCAL_MACHINE;
if rInstall.OpenKey(sRegKeyLoc, True)
then
begin
rInstall.WriteString('Description', 'Monitors for new log entries. Allows modification');
rInstall.CloseKey;
end; //This call works fine.
if rInstall.OpenKey(sODBCRegKeyLoc, True)
then
begin
rInstall.WriteString('DSN Name', 'SQL Native Client');
end; //This call fails with no error message.
if rInstall.OpenKey(sServerRegKeyLoc, True)
then
begin
rInstall.WriteString('Driver','c:\Windows\system32\sqlncli.dll');
rInstall.WriteString('Server','serverIP\SQLEXPRESS');
rInstall.WriteString('Database', 'Databasename');
end; //This call fails with no error message.
finally
rInstall.Free;
end; //Write values to registry.
어떤 도움을 주시면 감사하겠습니다.
제 3의 것이 의미가 있습니다. 나를 혼란스럽게하는 부분은 그 3 개의 키 중 첫 번째 키에 아무런 문제가 없다는 것입니다. OBDC.INI에서 두 개의 키만 실패합니다. –
프로세스를 실행 중입니까? 프로그램에 매니페스트가 있습니까? –
둘 다에 없습니다. 나는 집에 갈 때 그 제안을 주셔서 감사합니다. –