ActiveX Data Objects - PowerPoint PPT Presentation

1 / 35
About This Presentation
Title:

ActiveX Data Objects

Description:

?Borland ???Delphi ?C Builder ??????, ?????ADO ????????????? ADO ???????, ?????, ??ADOTable ?ADOQuery ... ?????????????AsStr ing ?AsInteger. ADOTable1- Insert ... – PowerPoint PPT presentation

Number of Views:275
Avg rating:3.0/5.0
Slides: 36
Provided by: qoo
Category:
Tags: activex | asstr | data | objects

less

Transcript and Presenter's Notes

Title: ActiveX Data Objects


1
????? ActiveX Data Objects
  • ???17 ?, ?????Borland Database Engine (??BDE)
    ????????, ???ActiveX Data Objects(????ADO)????????
    ???????????Borland ???Delphi ?CBuilder ??????,
    ?????ADO ?????????????ADO ???????, ?????,
    ??ADOTable ?ADOQuery ????BDE ?Table ?Query ??????
  • ADO???????
  • ????????
  • ????
  • ?????

2
ADO ?BDE ???
  • ???16 ?, ?????BCB ?????????4 ?, ???BDE ?ADO
    ?dbExpress ?InterBase, ??????????, ??BDE
    ?ADO?dbExpress ?InterBase ????????
  • ?BDE ???, ???????Table ?Query ?QuickRep
    ??????????????????????????????????ADO??,
    ???????????????????, ????, ???????, ???ADO
    ?????????????, ???BDE ??????ADO ?????????,
    ?????????

3
2 1 -1 ADO ???????
  • ???17-1 ?, ?????BDE ??????????, ???ADO??, ????BDE
    ???Table ???ADO ???ADOTable ??????, ?????????

4
??21-1a
  • ??ADOTable ???????????, ??school.mdb ?stugrade
    ????

5
2 1 - 2 ????????
  • ?BDE ???, ????????Table ?Query ??, ?ADO ??,
    ??ADOTable ?ADOQuery ?????

6
  • ADOTable
  • ADOTable ?Table ????????????????, ????????,
    ??????????, ??????????????????????????????????????
    ??????????
  • ???
  • ADOTable ???????????,??FieldByName
    ?Fields??????????????
  • ADOTable1-FieldValues" ????"
  • ADOTable1-FieldByName(" ????")-??????
  • ADOTable1-Fields-Fields????-??????

7
  • ??????,????????AsVariant ?AsString ?AsInteger
    ?AsFloat ?AsCurrency ?AsDateTime ?AsBoolean
    ???????????Text1 ??,????AsString ,??????String
    ?????,???????????0 ?Name ????Edit1 ???
  • Edit1-Text ADOTable1-FieldValues"Name"
  • Edit1-Text ADOTable1-FieldByName("Name")-AsSt
    ring
  • Edit1-Text ADOTable1-Fields-Fields0-AsStri
    ng
  • ??????????????,?????????????????????,???????Name
    ???????
  • ADOTable1Name-Value // ??????
  • ADOTable1Name-AsString

8
  • ????
  • ?????ADOTable ????????, ???????, ??????????????,
    ???????????, ?????????????, ???????????,
    ??????????????????, ??????

9
(No Transcript)
10
??21-2a
  • ???????????????????

11
??????
  • ??????????????, ??????????, ??????????????????????
    ??ADOTable1name ?ADOTable1chi ?ADOTable1eng
    ?????????, ???????????????????,
    ??????ADOTable1name ??????Edit1???
  • Edit1-TextADOTable1name-AsString

12
??21-2b
  • ?????????????

13
?????
  • ????????????, ??????Insert ?Post ??, ??Insert
    ?????????????Post ????????????????????????????,
    ????FieldByName (" ????") ?????,
    ??????????????????????????, ??????????????????????
    ??

14
  • // ?????????????AsStr ing ?AsInteger
  • ADOTable1-Insert()
  • // ??1 ????String
  • ADOTable1-FieldByName(" ????1")-AsString
  • Edit1-Text
  • // ??2 ????Integer
  • ADOTable1-FieldByName(" ????2")-AsInteger
  • StrToInt(Edit2-Text)
  • ADOTable1-Post()
  • ??????, ??Test1.mdb ?grade ??????????
  • // ?????????????AsStr ing ?AsInteger
  • ADOTable1-Insert()
  • ADOTable1-FieldByName("Name")-AsString "???"
  • ADOTable1-FieldByName("Chi")-AsInteger 92
  • ADOTable1-FieldByName("Eng")-AsInteger 88
  • ADOTable1-Post()

15
??21-2c
  • ???????(????test1.mdb ?grade ???)?

16
?????
  • ????????Delete ??????
  • ADOTab le 1.De le te
  • ???????????????????????????, ???????

17
??21-2d
  • ???????(???????????)

18
?????
  • ????????Edit ?Post ???, ?????
  • ADOTable1-Edit()
  • ADOTable1-FieldByName(" ????1")-AsString
  • Edit1-Text
  • ADOTable1-FieldByName(" ????2")-AsInteger
  • StrToInt(Edit2-Text)
  • / / ??????
  • ADOTable1-Post()
  • ???????????????????(??, DBEdi t),?????????????????
    ,??????????????????????
  • ADOTable1-Post()
  • ?????????grade ?????????????
  • ADOTable1-Edit()
  • ADOTable1-FieldByName("Name")-AsString "???"
  • ADOTable1-FieldByName("Chi")-AsInteger 22
  • ADOTable1-FieldByName("Eng")-AsInteger 33
  • ADOTable1-Post()

19
??21-2e
  • ???????(???????)?
  • 1. ??????????????, ??????????" ???" ????,
    ?????DBEdit ???????????, ?????" ???" ????

20
  • 2. ??????" ?????????", ???????????, ?
  • ?????, ??????
  • / / - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
  • / / ??????
  • void _ _fastcall TForm1btnEdit1Click(TObject
    Sender)
  • ADOTable1-Edit()
  • ADOTable1-FieldByName("Name")-AsString "???"
  • ADOTable1-FieldByName("Chi")-AsInteger 92
  • ADOTable1-FieldByName("Eng")-AsInteger 88
  • ADOTable1-Post()
  • / / - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -

21
  • 3. ???????" ??????" ???, ???????????,?????????DBTe
    xt ?????????
  • / / ?????????????
  • void _ _fastcall TForm1btnEdit2Click(TObject
    Sender)
  • ADOTable1-Post()

22
  • 4. ???????" ??????????" ???, ??????????
  • void _ _fastcall TForm1btnEdit3Click(TObject
    Sender)
  • ADOTable1-First()
  • while (! ADOTable1-Eof)
  • ADOTable1-Edit()
  • ADOTable1-FieldByName("Chi")-AsInteger
  • ADOTable1-FieldByName("Chi")-AsInteger 1.1
  • ADOTable1-Post()
  • ADOTable1-Next()

23
?????
  • ADO ????????, ????Locate ?Filter, ??????
  • Locate
  • Locate ?????
  • virtual bool _ _fastcall Locate(const AnsiString
    KeyFields,
  • const SystemVariant KeyValues,
  • TLocateOptions Options)
  • ????????
  • KeyFields ?????????
  • KeyValues ????????
  • Options ?????????TlocateOptions ?????, ????,
    ??loCaseInsensitive ???????????, loPartialKey
    ?????????, ????" ??", ??" ?????" ?" ????????",
    ????????
  • enum TLocateOption loCaseInsensitive,
    loPartialKey
  • ??????, Locate ????true, ??????????????????
    ???false, ??????????

24
??21-2f
  • ????????

25
Filter
  • ?????Locate ?????????, ???????, ??"chi60"
    ?"chi??????Filter?Filter ?????
  • ADOTable1-Filter " ??????????????"
  • ADOTable1-Filteredtrue

26
??21-2g
  • ??Filter ??????

27
??
  • ADOTable ????Sort ??????, Sort ??????, ??????ASC,
    ??????, ASC ?DESC ??????????
  • ADOTable1-Sort " ????"

28
??21-2h
  • ??Sort ??????

29
ADOQuery
  • ?BDE ???, ???Query ????SQL ??, ??ADO
    ??????ADOQuery ???SQL ???, ??????17-4 ??19 ???,
    ????ADOQuery ?????Query ??, ??????????ADOQuery
    ??test1.mdb ?grade ????

30
??21-2i
  • ??ADOQuery ???(????DBGrid ??test1.mdb ?grade ????

31
21 - 3 ????
32
ADOConnection
  • ???ADOTable ?ADOQuery ?????????????,
    ??????????????????, ???????ADOTable
    ?ADOQuery?????, ??????ConnectionString,
    ???????????????????????, ?????????????,
    ????ADOConnection ???
  • ???????????ADOConnection ?????????, ??????????

33
??21-3a
  • ????????, ??????test1.mdb ?stuname, ??????stugrd ?

34
21 - 4 ?????
  • ADO ??????BDE ???????????, ?????????ADO
    ????????????????test1.mdb ?grade ?????ADO ????,
    ????????18 ??

35
??21-4a
  • ????????(?????test1.mdb ?grade ????)
Write a Comment
User Comments (0)
About PowerShow.com