-
Notifications
You must be signed in to change notification settings - Fork 0
/
How to use Microsoft Access
48 lines (44 loc) · 2.06 KB
/
How to use Microsoft Access
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
;; How to use MDB files
;; Carlos A L Cordovil
INI Set mdbFILE="C:\ISI\DB1.mdb"
ZSetObj DB=$ZCreateObject("ADODB.Connection")
ZSetObj RecSet=$ZCreateObject("ADODB.RecordSet")
ZSetObj Total=$ZCreateObject("ADODB.RecordSet")
Do DB.Open("Driver={Microsoft Access Driver (*.mdb)}; DBQ="_mdbFILE)
Do Total.Open("SELECT COUNT(CODFI) AS TOTAL FROM MOVIES",DB)
Write #,"** DB Connect"
Write !,"** Total lines: ",Total.Fields("TOTAL")
Do Total.Close
For Do COD Quit:COD=""
Quit
COD Read !!,"Code Number: ",COD#10:60
If COD="" Do CLEAR Quit
If COD?1"!".E Do INSERT Quit
If COD?1"*".E Do SHOW Quit
New SQL
Set SQL="SELECT * FROM MOVIES WHERE CODFI="_COD
Do RecSet.Close
Do RecSet.Open(SQL,DB)
If RecSet.Eof=-1 Set ER="Not find" Do ER Quit
Write !,"> Title: ",RecSet.Fields("TIT")
Write !,"> Cat : ",RecSet.Fields("CAT")
Quit
INSERT New I
Do DB.Execute("INSERT INTO MOVIES (CODFI,TIT,CAT) VALUES ('"_COD_"','"_TIT_"','"_CAT_"')")
Write !,"** Successful insert **"
Quit
SHOW Write !!,"===================================================="
Do RecSet.OPEN("SELECT * FROM MOVIES",DB)
Do RecSet.MoveFirst
For Quit:RecSet.Eof=-1 Do
. Set COD=RecSet.Fields("CODFI")
. Set TIT=RecSet.Fields("TIT"),CAT=RecSet.Fields("CAT")
. Write !,TIT,?60,CAT
. Do RecSet.MoveNext
Write !,"===================================================="
Quit
CLEAR Kill mdbFILE,DB,RecSet,Total
Quit