English 中文(简体)
德尔菲:SQLite和UniDac
原标题:Delphi: SQLite and UniDac

需要在 SQLite 中存储一些数据。 要与 SQLite 选择 UniDac 合作, 但有一个问题: 当在 UniConnection 中, 在“ 数据库” 字段中, 我选择 SQLite 并输入数据库的名称 - 获取错误“ 不支持的元数据类型 ” 。 数据库文件没有创建。 与 UniDac 一起工作的问题是什么? 与 UniDac 一起工作的问题是什么? 那么这些问题就不会被观察到 。

最佳回答

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;
问题回答

暂无回答




相关问题
determining the character set to use

my delphi 2009 app has a basic translation system that uses GNUGetText. i had used some win API calls to prepare the fonts. i thought it was working correctly until recently when someone from Malta ...

Help with strange Delphi 5 IDE problems

Ok, I m going nuts here. For the last (almost) four years, I ve been putting up with some extremely bad behavior from my Delphi 5 IDE. Problems include: Seemingly random errors in coride50.bpl ...

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How convert string to integer in Oxygene

In Delphi, there is a function StrToInt() that converts a string to an integer value; there is also IntToStr(), which does the reverse. These functions doesn t appear to be part of Oxygene, and I can ...

Quick padding of a string in Delphi

I was trying to speed up a certain routine in an application, and my profiler, AQTime, identified one method in particular as a bottleneck. The method has been with us for years, and is part of a "...

热门标签