if RegIE.Openkey('Software\ODBC\ODBC.INI',false) = False then begin Application.MessageBox('设置当前注册表键时出错。','错误信息',MB_ICONERROR); exit; end; --------------------->>>>>>>>>>>>这里一定要注意了,没有分号!!! RegIE.GetKeyNames(odbc_dsn);
着急了,漏了一句: if RegIE.Openkey('Software\ODBC\ODBC.INI',false) = False then begin Application.MessageBox('设置当前注册表键时出错。','错误信息',MB_ICONERROR); exit; end; --------------------->>>>>>>>>>>>这里一定要注意了,没有分号!!! else ------------在这里加上一个else RegIE.GetKeyNames(odbc_dsn);
还是不行啊,错误信息如下:“Project manager raised exception class EAccessViolation with message 'Access violation at address 00440537 in module 'manager.exe''.Read of address 00000000'.Process stopped.Use Step or Run to continue.”我改成这个样子了:try if RegIE.Openkey('Software\ODBC\ODBC.INI',false) = False then begin Application.MessageBox('ÉèÖõ±Ç°×¢²á±í¼üʱ³ö´í¡£','´íÎóÐÅÏ¢',MB_ICONERROR); exit; end else RegIE.GetKeyNames(odbc_dsn); except Application.MessageBox('¶ÁÈ¡DSNÁбíʱ³ö´í¡£','´íÎóÐÅÏ¢',MB_ICONERROR); Close; end; Regie.CloseKey; RegIE.Free;
begin
Application.MessageBox('设置当前注册表键时出错。','错误信息',MB_ICONERROR);
exit;
end; --------------------->>>>>>>>>>>>这里一定要注意了,没有分号!!!
RegIE.GetKeyNames(odbc_dsn);
if RegIE.Openkey('Software\ODBC\ODBC.INI',false) = False then
begin
Application.MessageBox('设置当前注册表键时出错。','错误信息',MB_ICONERROR);
exit;
end; --------------------->>>>>>>>>>>>这里一定要注意了,没有分号!!!
else ------------在这里加上一个else
RegIE.GetKeyNames(odbc_dsn);
if RegIE.Openkey('Software\ODBC\ODBC.INI',false) = False then
begin
Application.MessageBox('ÉèÖõ±Ç°×¢²á±í¼üʱ³ö´í¡£','´íÎóÐÅÏ¢',MB_ICONERROR);
exit;
end
else
RegIE.GetKeyNames(odbc_dsn);
except
Application.MessageBox('¶ÁÈ¡DSNÁбíʱ³ö´í¡£','´íÎóÐÅÏ¢',MB_ICONERROR);
Close;
end;
Regie.CloseKey;
RegIE.Free;