惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Proofpoint News Feed
V2EX - 技术
V2EX - 技术
F
Full Disclosure
P
Privacy & Cybersecurity Law Blog
The GitHub Blog
The GitHub Blog
P
Palo Alto Networks Blog
T
Threat Research - Cisco Blogs
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Latest news
Latest news
Y
Y Combinator Blog
P
Proofpoint News Feed
Cyberwarzone
Cyberwarzone
A
Arctic Wolf
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Tor Project blog
B
Blog RSS Feed
S
Schneier on Security
H
Hackread – Cybersecurity News, Data Breaches, AI and More
N
Netflix TechBlog - Medium
小众软件
小众软件
博客园 - Franky
T
The Exploit Database - CXSecurity.com
V
V2EX
V
Vulnerabilities – Threatpost
Know Your Adversary
Know Your Adversary
C
Check Point Blog
L
LINUX DO - 热门话题
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
L
Lohrmann on Cybersecurity
人人都是产品经理
人人都是产品经理
S
Securelist
U
Unit 42
博客园 - 叶小钗
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
博客园 - 三生石上(FineUI控件)
C
Cyber Attacks, Cyber Crime and Cyber Security
G
GRAHAM CLULEY
T
Tailwind CSS Blog
Stack Overflow Blog
Stack Overflow Blog
G
Google Developers Blog
量子位
Hacker News - Newest:
Hacker News - Newest: "LLM"
NISL@THU
NISL@THU
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
T
Threatpost
N
News | PayPal Newsroom
L
LangChain Blog
宝玉的分享
宝玉的分享
C
CXSECURITY Database RSS Feed - CXSecurity.com
爱范儿
爱范儿

博客园 - 万一

关于内存数据与 JSON 高亮 TRichEdit 当前行 使用 IntraWeb (45) - 活用 IntraWeb 使用 IntraWeb (44) - 测试读取 SqLite (三) 使用 IntraWeb (43) - 测试读取 SqLite (二) 使用 IntraWeb (41) - 数据控件速查 使用 IntraWeb (40) - 自定义 Session 数据 使用 IntraWeb (39) - THttpRequest、THttpReply 使用 IntraWeb (38) - TIWAppForm、TIWForm、TIWBaseHTMLForm、TIWBaseForm 使用 IntraWeb (37) - TIWApplication 使用 IntraWeb (36) - TIWServerControllerBase 使用 IntraWeb (35) - TIWJQueryWidget 使用 IntraWeb (34) - TIWAJAXNotifier 使用 IntraWeb (33) - Cookie 使用 IntraWeb (32) - Url 映射与 THandlers 使用 IntraWeb (31) - IntraWeb 的 Xml 操作使用的是 NativeXml 使用 IntraWeb (30) - TIWAppInfo、TIWMimeTypes、TIWAppCache 使用 IntraWeb (29) - 基本控件之 TIWAutherList、TIWAutherINI、TIWAutherEvent 使用 IntraWeb (28) - 基本控件之 TIWTemplateProcessorHTML、TIWLayoutMgrHTML、TIWLayoutMgrForm
使用 IntraWeb (42) - 测试读取 SqLite (一)
万一 · 2014-06-28 · via 博客园 - 万一

为通过 FireDAC(XE5开始支持的) 使用 SqLite, 现在已换成 XE6 + IntraWeb v14.0.32 Ultimate.

首先把官方提供的 C:\Users\Public\Documents\Embarcadero\Studio\14.0\Samples\data\FDDemo.sdb 复制到程序目录下, 用于测试.


在空白窗体上添加控件:


FDPhysSQLiteDriverLink1: TFDPhysSQLiteDriverLink;
FDGUIxWaitCursor1: TFDGUIxWaitCursor;
FDConnection1: TFDConnection;
DataSource1: TDataSource;
FDTable1: TFDTable;
IWDBGrid1: TIWDBGrid;

在 OnCreate 事件中写代码:


procedure TIWForm1.IWAppFormCreate(Sender: TObject);
begin
  FDTable1.Connection := FDConnection1;
  DataSource1.DataSet := FDTable1;
  IWDBGrid1.DataSource := DataSource1;

  FDConnection1.DriverName := 'SQLite';
  FDConnection1.Params.Add('Database=FDDemo.sdb'); //如果测试数据在其他目录, 如: Database=C:\Temp\FDDemo.sdb; 但要真放到网络上恐怕有权限限制

  FDTable1.TableName := 'Orders'; //Orders 是 FDDemo.sdb 中的一个表
  FDTable1.Active := True;

  IWDBGrid1.Align := alClient;
end;

效果图:


TFDQuery 代替 TFDTable 重新测试:


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;