-
-
Notifications
You must be signed in to change notification settings - Fork 336
Expand file tree
/
Copy pathExample4.py
More file actions
30 lines (25 loc) · 604 Bytes
/
Copy pathExample4.py
File metadata and controls
30 lines (25 loc) · 604 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import DBFireDac
# Create and open the Query
Q = DBFireDac.TFDQuery(None)
Q.ConnectionDefName = "SQLite_DB"
Q.SQL.Text = """select *
from ORDERS
"""
Q.Open() # or Q.Active = True
# Display columns
print ("Columns: ", Q.FieldNamesAsTuple())
# For each record of the table
Q.First()
while not Q.EOF:
# Get all the fields in a list
A = []
for i in range( 0, Q.FieldCount ):
A.append( Q.Fields(i).AsString )
# Print the current record number and the list
print ("Rec.", Q.RecNo, ":", A)
# Get next record
Q.Next()
#
Q.Close()
# delete the Query
del Q