Hi how can i create a ODBC alias for my program with a interbase db with the odbc drivers, i want te create the alias within te program or at instalation, tnx
Hi,I try to using TRegistry component,It's work.Attach a sample code ,it's for create a ODBC entry with SQL Server:
var
Reg : TRegistry;
ServerName : string;
begin
ServerName := NtNetinfo.ComputerName ;
try
Reg := TRegistry.Create;
Reg.RootKey := HKEY_LOCAL_MACHINE;
if Reg.KeyExists('\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources') then
begin
Reg.OpenKey('\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources',True);
Reg.WriteString('OMSDATA','SQL Server');
Reg.CloseKey;
end;
if Reg.KeyExists('\SOFTWARE\ODBC\ODBC.INI\omsdata') = False then
Reg.CreateKey('\SOFTWARE\ODBC\ODBC.INI\omsdata');
if Reg.OpenKey('\Software\ODBC\ODBC.INI\omsdata', True) then
begin
Reg.WriteString('Database','omsdata');
Reg.WriteString('Driver','D:\winnt\system32\sqlsrv 32.dll');
Reg.WriteString('Lastuser','sa');
Reg.WriteString('Server',Servername);
Reg.WriteString('Network libraries','TCP/IP');
end;
finally
Reg.CloseKey;
Reg.Free;
inherited;
end;
vBulletin® v3.8.7, Copyright ©2000-2013, vBulletin Solutions, Inc.