Use Intraweb (43)-Test read SqLite (ii)

Source: Internet
Author: User



Generally, the data source related control should have the unified management of the data module, which is also convenient for other forms to call; Usersessionunit is a ready-made data module.
Now put the data source related controls on the Usersessionunit form:
FDPhysSQLiteDriverLink1: TFDPhysSQLiteDriverLink;
FDGUIxWaitCursor1: TFDGUIxWaitCursor;
FDConnection1: TFDConnection;
DataSource1: TDataSource;
FDTable1: TFDTable;

and write the code in its OnCreate event:
procedure TIWUserSession.IWUserSessionBaseCreate(Sender: TObject);
begin
  FDTable1.Connection := FDConnection1;
  DataSource1.DataSet := FDTable1;

  FDConnection1.DriverName := ‘SQLite‘;
  FDConnection1.Params.Add(‘Database=FDDemo.sdb‘);

  FDTable1.TableName := ‘Orders‘;
  FDTable1.Active := True;
end;

Only Iwdbgrid1:tiwdbgrid is left on the main form, and its code is simpler:
uses ServerController; {for UserSession}

procedure TIWForm1.IWAppFormCreate (Sender: TObject);
begin
   IWDBGrid1.DataSource: = UserSession.DataSource1;
   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.