delphi 下的数据库连接工具,UniDAC 7.4.11 For Delphi 10.3 RIO 破解版,示例代码:
uses
uni, Data.DB, SQLiteUniProvider;
var
conn: TUniConnection;
q: TUniQuery;
sqlString: string;
field: TField;
begin
conn := TUniConnection.Create(nil);
try
conn.ProviderName := 'SQLite';
conn.Database := 'foo.db';
conn.SpecificOptions.Values['SQLite.ClientLibrary'] := 'sqlite3.dll';
conn.SpecificOptions.Values['UseUnicode'] := 'True';
conn.SpecificOptions.Values['ASCIIDataBase'] := 'False';
//conn.SpecificOptions.Values['EncryptionKey'] := 'secret';
conn.Open;
sqlString := 'SELECT * FROM bar';
q := TUniQuery.Create(nil);
try
q.Options.TrimVarChar := True;
q.Connection := conn;
q.SQL.Text := sqlString;
q.Open;
while not q.Eof do
begin
for field in q.Fields do
begin
Winapi.Windows.OutputDebugString(PWideChar(field.Name + ': ' + field.AsString));
end;
q.Next;
end;
finally
q.Close;
q.Free;
end;
finally
conn.Close;
conn.Free;
end;
end;
1