![]() |
ADO Connection in eine UDL-Datei speichern
Mit folgender Procedure kann man einen ADO Connection String in eine UDL-Datei speichern.
Man sollte darauf achten, dass der Connection String nicht schon seinerseits auf eine UDL-Datei verweist.
Delphi-Quellcode:
[edit=Matze]Code formatiert. Mfg, Matze[/edit]
{**************************************************************************
* NAME: SaveConnectionToUDLFile * DESC: stores a connection string into a UDL file *************************************************************************} procedure SaveConnectionToUDLFile(const connstr:string; const filename:string); procedure SaveWideStringToFile(const ws:WideString; const filename:string); var fs : TFileStream; begin fs := TFileStream.Create(filename, fmCreate); try fs.WriteBuffer(ws[1], Length(ws)*sizeof(Widechar)); finally fs.Free; end; end; var ws : WideString; begin ws := ' [oledb]'#13#10+ '; Everything after this line is an OLE DB initstring'#13#10+ Trim(connstr); s[1] := Widechar($FEFF); SaveWideStringToFile(ws, filename); end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:06 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz