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 判断是否为二进制文件

Delphi 如何确定windows安装的语言

Delphi tdictionary保存到文件

Delphi xe8 支持md5

Delphi indy 组件包里的 idhttp 组件使用 get 方法下载文件限速的方法

Delphi 分享三个随机字符串

Delphi 变体数组

Delphi 系统服务运行桌面用户指定程序

Delphi concat 字符串函数

Delphi tradiogroup 单选分组框组件

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



打赏

取消

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

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

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

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

评论

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

    正在狠努力加载,请稍候...