如何在控制面板中删除ODBC,不要隐藏!!!

时间:2022-03-14 03:10:50

//删除注册的ODBC
procedure OBDCDelete(ODBCName:string);
var registerTemp:TRegistry;
begin
   registerTemp := TRegistry.Create;
   with registerTemp do
   begin
   try
     RootKey:=HKEY_LOCAL_MACHINE;
      if OpenKey(‘SoftwareODBCODBC.INIODBC Data Sources‘,True) then
       begin //注册一个DSN名称
DeleteValue(ODBCName);
       end ;
     closeKey;
     registerTemp.DeleteKey(‘SoftwareODBCODBC.INI‘ odbcname);
   except
   end;
   end;
   registerTemp.Free;
end;