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
43
44
45
46
47
48
49
50
| ' Gambas class file
' Gambas class - FMain
' but : tester les dates dans la base de données MySQL
' mysql -umoi -p ' use test; ' create table les_dates (id smallint auto_increment, moment datetime, primary key(id)); ' insert into les_dates (moment) values ('20170913214700');
PRIVATE c AS Connection
PUBLIC SUB Form_Open()
c = NEW Connection
WITH c .Name = "test" .Login = "moi" ' << --- change here .Password = "" ' << --- change here .Type = "MySQL" .Port = 3306 .Open() END WITH
ShowContentOfDatabase() ' note : la lecture se fait correctement selon test.
END
PUBLIC SUB btnDbUpdate_Click()
c.Exec("update les_dates set moment=&1 where id=1", DateBox1.Value) ShowContentOfDatabase()
END
PRIVATE SUB ShowContentOfDatabase()
DIM d AS DATE DIM r AS Result
r = c.Exec("select moment from les_dates where id=1") r.MoveFirst()
d = r!moment DateBox1.Value = d
END
|