UniDAC 4.1.6 与 Delphi XE2 I 的 UIDAC 4.1.6 没有看到任何问题。 SQLite3. dll 必须位于系统路径或与您的可执行文件相同的目录中。 下面非常基本的示例会在单击 btnConnect 时创建数据文件 。
unit uMain;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Grids, Vcl.DBGrids, UniProvider,
SQLiteUniProvider, Data.DB, MemDS, DBAccess, Uni, Vcl.ExtCtrls, Vcl.DBCtrls,
Vcl.StdCtrls;
type
TfrmMain = class(TForm)
UniDataSource1: TUniDataSource;
UniConnection1: TUniConnection;
UniQuery1: TUniQuery;
SQLiteUniProvider1: TSQLiteUniProvider;
DBGrid1: TDBGrid;
edtDBName: TEdit;
Label1: TLabel;
DBNavigator1: TDBNavigator;
btnConnect: TButton;
procedure btnConnectClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmMain: TfrmMain;
implementation
{$R *.dfm}
procedure TfrmMain.btnConnectClick(Sender: TObject);
begin
if (btnConnect.Caption = Connect ) then
begin
UniConnection1.ProviderName := SQLite ;
UniConnection1.Database := ExtractFilePath(Application.ExeName)
+ edtDBName.Text;
UniConnection1.Connect;
btnConnect.Caption := Disconnect ;
end
else
begin
UniConnection1.Disconnect;
btnConnect.Caption := Connect ;
end;
end;