BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Can i create odbc alias using delphi 8

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers)
View previous topic :: View next topic  
Author Message
Plusinfo
Guest





PostPosted: Wed Oct 27, 2004 8:27 pm    Post subject: Can i create odbc alias using delphi 8 Reply with quote




Can i create odbc alias for mssql using code in vcl delphi 8 pro
If i can please tell me how
Thanks
Back to top
Jan Doggen
Guest





PostPosted: Thu Oct 28, 2004 11:12 am    Post subject: Re: Can i create odbc alias using delphi 8 Reply with quote



This is from one of our apps.
I didn't write it, so I can't answer questions

Bye
Jan

reg := TRegistry.create;

// Create DSN
reg.RootKey := HKEY_CURRENT_USER;
key := 'Softwareodbcodbc.ini';

If reg.openkey(key, true) then begin
If reg.Openkey('dbIISRap', true) then begin
dbPathname := EdtDatabase.Text;

{ Let op: bij Pathname dient de correcte verwijzing naar de
locatie van de IIS-Rapport.mdb te staan.
Deze locatie dient ook in de Params Properties van
dbIISRap TDatabase te worden ingevoerd }

reg.WriteString('DBQ', dbPathName);
GetSystemDirectory(systemDir, 255);
reg.Writestring('Driver', systemdir + 'odbcjt32.dll');
reg.WriteString('FIL', 'MS Access;');

// Writestring accepteert geen lege string, zodoende rechtstreeks
regSetvalueEx(reg.currentkey, PChar('UID'), 0, REG_SZ, PChar(''), 1);
regSetvalueEx(reg.currentkey, PChar('PWD'), 0, REG_SZ, PChar(''), 1);

reg.WriteInteger('DriverID', 281);
reg.WriteInteger('Safe Transactions', 0);
end;
reg.closeKey;
end;

// Entry toevoegen
Key := 'SoftwareODBCODBC.INIODBC Data Sources';
If Reg.OpenKey(Key, true) then begin
Reg.writestring('dbIISRap', 'Microsoft Access Driver (*.mdb)');
Reg.CloseKey;
end;

Reg.Free;


"Plusinfo" <velaxoutakos (AT) plusinfo (DOT) gr> wrote

Quote:

Can i create odbc alias for mssql using code in vcl delphi 8 pro
If i can please tell me how
Thanks



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.