杉宫竹苑工作室

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 2029|回复: 0

Inno Setup 制作的安装程序直接访问Access数据库

[复制链接]
发表于 2017-1-2 17:58:53 | 显示全部楼层 |阅读模式

正式会员享受无限制浏览网站功能和高速网盘下载,赶快加入本站吧!

您需要 登录 才可以下载或查看,没有账号?立即注册

x
  1. [Code]
  2. procedure SaveSecureKey;
  3. var
  4.   AccessServer: Variant;
  5.   RecordAffected: Integer;
  6. begin
  7.   try
  8.     AccessServer := CreateOleObject ('ADODB.Connection');
  9.   except
  10.     RaiseException ('Failed to create ADODB object!');
  11.   end;

  12.   AccessServer.ConnectionString := Format (
  13.     'Provider=%s;Data Source=%s%s;Persist Security Info=False;' +
  14.     'Jet OLEDB:Database Password=123456',
  15.     ['Microsoft.Jet.OLEDB.4.0', 'd:/temp/', 'data.mdb']);
  16.   try
  17.     AccessServer.Open;
  18.     try
  19.       AccessServer.Execute ('DELETE * FROM dic_SysParams');
  20.       AccessServer.Execute (
  21.         Format ('INSERT INTO dic_SysParams(Sp_SecureKey)' +
  22.           'values (''%s'');', ['1234567890']));
  23.     except
  24.       RaiseException ('Failed to initialize secure key value!');
  25.     end;

  26.   finally
  27.     AccessServer.Close;
  28.   end;
  29. end;
复制代码


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|手机版|Archiver|SgzyStudio

GMT+8, 2024-5-19 17:52 , Processed in 0.116923 second(s), 22 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表