Using Intraweb (42)-Test read SqLite (one)

Source: Internet
Author: User
Tags sqlite



SqLite is now replaced with XE6 + intraweb v14.0.32 Ultimate for use with FireDAC (XE5 start support).

First copy the officially provided C:\USERS\PUBLIC\DOCUMENTS\EMBARCADERO\STUDIO\14.0\SAMPLES\DATA\FDDEMO.SDB to the program directory for testing.
To add a control on a blank form:
FDPhysSQLiteDriverLink1: TFDPhysSQLiteDriverLink;
FDGUIxWaitCursor1: TFDGUIxWaitCursor;
FDConnection1: TFDConnection;
DataSource1: TDataSource;
FDTable1: TFDTable;
IWDBGrid1: TIWDBGrid;

Write the code in the OnCreate event:
procedure TIWForm1.IWAppFormCreate (Sender: TObject);
begin
   FDTable1.Connection: = FDConnection1;
   DataSource1.DataSet: = FDTable1;
   IWDBGrid1.DataSource: = DataSource1;

   FDConnection1.DriverName: = ‘SQLite’;
   FDConnection1.Params.Add (‘Database = FDDemo.sdb’); // If the test data is in another directory, such as: Database = C: \ Temp \ FDDemo.sdb; But if you really put it on the network, I am afraid there are permission restrictions

   FDTable1.TableName: = ‘Orders’; // Orders is a table in FDDemo.sdb
   FDTable1.Active: = True;

   IWDBGrid1.Align: = alClient;
end;

:

Tfdquery instead of tfdtable re-test:
procedure TIWForm1.IWAppFormCreate(Sender: TObject);
begin
  FDQuery1.Connection := FDConnection1;
  DataSource1.DataSet := FDQuery1;
  IWDBGrid1.DataSource := DataSource1;

  FDConnection1.Open(‘DriverID=SQLite;Database=FDDemo.sdb‘);
  FDQuery1.Open(‘SELECT * FROM Orders‘);

  IWDBGrid1.Align := alClient;
end;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.