`
byebyegov5qq
  • 浏览: 1219802 次
文章分类
社区版块
存档分类
最新评论

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

 
阅读更多
Inno Setup 灵巧的制作手法博得众多软件爱好者的喜爱,它提供的 Pascal 脚本动态执行功能更受大家关注和研究。以下是本人用Inno Setup的Pascal脚本实现在软件安装过程中即时访问Microsoft Access数据库的代码,供大家学习和参考。(以下代码仅含 [Code] 部分)

[Code]
procedure SaveSecureKey;
var
AccessServer: Variant;
RecordAffected: Integer;
begin
try
AccessServer := CreateOleObject ('ADODB.Connection');
except
RaiseException ('Failed to create ADODB object!');
end;
AccessServer.ConnectionString := Format (
'Provider=%s;Data Source=%s%s;Persist Security Info=False;' +
'Jet OLEDB:Database Password=123456',
['Microsoft.Jet.OLEDB.4.0', 'd:/temp/', 'data.mdb']);
try
AccessServer.Open;
try
AccessServer.Execute ('DELETE * FROM dic_SysParams');
AccessServer.Execute (
Format ('INSERT INTO dic_SysParams(Sp_SecureKey)' +
'values (''%s'');', ['1234567890']));
except
RaiseException ('Failed to initialize secure key value!');
end;

finally
AccessServer.Close;
end;
end;
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics