forked from magdy-ragab/werdy
/
testdb.ring
42 lines (22 loc) · 888 Bytes
/
testdb.ring
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
31
32
33
34
35
36
37
38
39
40
41
42
# Project : Werdy Application
# Author : Magdy Ragab
Load "guilib.ring"
see "Add Records to SQLite Database" + nl
cDir = currentdir() + "\"
oCon = new QSqlDatabase()
oCon = oCon.addDatabase("QSQLITE")
oCon.setDatabaseName("test.db")
oCon.open()
query = new QSqlQuery( )
query.exec("insert into person (id, firstname, lastname, age) values (1,'Mahmoud','Fayed',29) ")
query.exec("insert into person (id, firstname, lastname, age) values (2,'Mohammed','Fayed',31) ")
query.exec("insert into person (id, firstname, lastname, age) values (3,'Ahmed','Fayed',26) ")
query.exec("insert into person (id, firstname, lastname, age) values (4,'Ibrahim','Fayed',24) ")
see copy("*",60) + nl
See "Display records" + nl
query.exec("select * from person")
while query.movenext()
for x = 0 to 3
see query.value(x).tostring() + nl next
see copy("*",60) + nl
end