Delphi UDL文件创建


本文整理自网络,侵删。

 
procedure WriteUDLFile (const UDLFile: string);
const
 // Default ConnectionString used by our application (SQL Server)
 SConnect = 'Provider=SQLOLEDB.1;User ID=sa;Initial Catalog=OurExampleDB;' +
            'Data Source=OURSERVER;Packet Size=4096';
var
 DataInitialize: IDataInitialize;
 wUDLFile: array[0..MAX_PATH - 1] of WideChar;
begin
 // Create the DataInitialize object
 DataInitialize := CreateComObject(CLSID_DataLinks) as IDataInitialize;

 // Convert AnsiString parameter to WideChar
 StringToWideChar (UDLFile, @wUDLFile, MAX_PATH);

 // Call method WriteStringToStorage with the default ConnectionString above. www.delphitop.com
 if Failed(DataInitialize.WriteStringToStorage(wUDLFile, SConnect, CREATE_NEW)) then
   raise Exception.Create('Can''t write UDL');
end;


procedure TForm2.Button1Click(Sender: TObject);
begin
 WriteUDLFile('C:\Trash\test.udl');
end;

相关阅读 >>

Delphi xe 打开andorid gps设置

Delphi extctrls.frame3d

Delphi gdi+基本用法总结

Delphi tdsauthenticationmanager的用法

Delphi vcl gif 动画

Delphi 程序重新启动自身

Delphi 如何判断可见字符 unicode

Delphi里面判断一个字符串在另一个字符串中出现的次数

Delphi剪切板-监视剪贴板

tidhttpresponseinfo 中文乱码问题解决

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...