ASP?????? - PowerPoint PPT Presentation

1 / 61
About This Presentation
Title:

ASP??????

Description:

Title: ASP Last modified by: Created Date: 5/11/2004 12:43:14 AM Document presentation format: Company: Microsoft China – PowerPoint PPT presentation

Number of Views:48
Avg rating:3.0/5.0
Slides: 62
Provided by: hrb3zNetzi
Category:

less

Transcript and Presenter's Notes

Title: ASP??????


1
ASP??????
  • ??? ??

2
???
  • ??????????
  • ??asp?????
  • ???????
  • ??ASP?????

3
??????????
  • ????????
  • HTML?? (?)
  • Vbscript?????

???
4
1?????????
  • ??????????
  • ????????????
  • ??????????
  • ASP??

???? ???
5
??????????
  • ???????????
  • ???????????

6
????????????
  • ??????????????????????,????????????????????????
    ??,?????HTML?????????????????,?????????
  • ?????????????????????????,????????????????HTML??
    ?????????

????
7
??????????
  • ????
  • ????

8
Active server page
????????
  • Asp???????????????,???????,????WEB????????????????
    ?,??????????WEB????PWS?IIS?APACHE??
  • ASP???????.asp?ASP???????????????,????VBSCRIPT?jsc
    ript????????WEB??????????

????
9
?????????
  • ??
  • TCP/IP??
  • PWS?IIS
  • ???127.0.0.1?????IP??,???LOCALHOST?

????
10
WEB?????????
  • PWS???
  • IIS???
  • WEB?????

????
11
??????
  • ???
  • Frontpage
  • Dreamwaver
  • Visual interdev
  • Editplus

????
12
?????asp??
  • lt!--???html??,?????????!???????--gt
  • ltp align"center"gtltfont size7
    colorredgt????????!lt/fontgtlt/pgt
  • ltp align"center"gt?????????
  • lt'??????????
  • '????????????????shijian
  • Shijiannow
  • '????????????
  • response.write shijian gt
  • ltscript language"vbscript"gt
  • lt!--'?????????
  • msgbox "????????!"
  • --gt
  • lt/scriptgt

13
Asp????
  • Asp???????
  • Asp????????????
  • ???HTML???
  • ?????script????,??lt gt??
  • ????script????,??ltscript languagescript??gtlt!--
    --gtlt/scriptgt??

14
Asp?????
  1. ???????????script????????ltgt????,???????script???
    ?????ltscript languagescript??gtlt!--
    --gtlt/scriptgt???
  2. Asp?????????vbscript,???????????????????lt_at_languag
    ejavascriptgt ???

15
??asp????????
  1. ?????????
  2. ???????????????,????????????????????
  3. Asp????????,???????
  4. ?????????,???????,???????
  5. ????????,???????????
  6. ????????,?????????????????????????????

16
2?vbscript?????
  • ??????????
  • ?????
  • ???
  • ???????
  • ????
  • ??????

???
17
??????????
  • ????,Vbscript?????????,??variant(????),????????,??
    ????????????,??
  • 1?empty
  • 2?null
  • 3?boolean
  • 4?byte
  • 5?integer
  • 6?long
  • 7?single
  • 8?double
  • 9?date(time)
  • 10?object
  • 11?error
  • ?????,variant???????????????,????????????????
    ?

???? ???
18
??????????
  • ????
  • const const_pi3.1415926 ?PI3.1415926,???????
    ???
  • ?????
  • 1?????
  • ??dim a ????a ?? dim a,b,c ???????,??
  • 2?????
  • var_a2 ???????,??????????????,??????????
  • 3 ???????
  • ???????ltoption explicitgt?????
  • ????????????????????????,?????????????,??????????
    ????,???vbscript????,?????255?????????????????????
    ????

???? ???
19
?????
  • Dim name(????-1)
  • ??ARRAY???????
  • ?????array(???1,???2,,???n)
  • ??????
  • ?Dim a() ?redim a(n) n??????????????.????????
    ??????dim(n),n???.
  • ????
  • Dim name(n-1,m-1)

???? ???
20
???
? ???? ?

?? ?? ?? ?? ?? ?? ?? ?? ?? ??
?? ?? ?? - ?? ,/ \ ???? \ ???? MOD??? MOD??? ?-
?? ? ?????,????????? ? ?????,????????? ? ?????,????????? ? ?????,????????? ? ?????,????????? ? ?????,????????? ? ?????,????????? ? ?????,????????? ? ?????,?????????
?? ?gt ?lt ?gt ?lt ?ltgt ?like ?is?????,????????? ?gt ?lt ?gt ?lt ?ltgt ?like ?is?????,????????? ?gt ?lt ?gt ?lt ?ltgt ?like ?is?????,????????? ?gt ?lt ?gt ?lt ?ltgt ?like ?is?????,????????? ?gt ?lt ?gt ?lt ?ltgt ?like ?is?????,????????? ?gt ?lt ?gt ?lt ?ltgt ?like ?is?????,????????? ?gt ?lt ?gt ?lt ?ltgt ?like ?is?????,????????? ?gt ?lt ?gt ?lt ?ltgt ?like ?is?????,????????? ?gt ?lt ?gt ?lt ?ltgt ?like ?is?????,?????????
?? Not? And? And? Or? Or? Xor?? Eqv?? Imp?? Imp??
? ? ? ? ? ?
???? ???
21
????
?? ?? ?? ??
???? ???? ????????????????.
????? AASP ????????ASP??????.
???? A2004/5/5 ???????2004/5/5???????
_ ????? Aa _ sp ???????????????.??_??????????????.
???? ???
22
Vbscript??
  • ?????????????????????,??????????????
  • ?????vbscript??
  • ????
  • Cstr(variant)???????????
  • Cdate(variant)??????????
  • Cint(variant)??????????

23
2??????
  1. Len(string)??????????
  2. Trim(string)???????????
  3. Mid(string,start,length)?string????start??????leng
    th???????
  4. Lcase(string)???????????
  5. Ucase(string)???????????

24
2??????
  • 6?Replace(string1,find,replacewith)?????,?????????
    ??(find)???????????(replacewith)
  • 7?Strcomp(string1,string2)???????,???1?2?null???nu
    ll,???1??2???-1,??2???1,??2???0?
  • 8?Instr(string1,string2)?????2?????????,????0

25
3????????
  1. Date()????????
  2. Time()????????
  3. Now()????????????
  4. Weekday(date)??????????1?????,?????

26
4?????
  • Int(num)????????num???
  • Rnd()????0?1????
  • ????????
  • ltrandomize ??????,???????????
  • numint(10rnd()1) rnd()???????0??1???,??????
    ??110????????10???1,?????
  • response.write numgt
  • ???1-60???

27
????
  • ??????
  • 1?If ??? then
  • ????
  • End if
  • 2?If ??? then
  • ?????
  • else
  • ?????
  • End if
  • 3?If ???a then
  • ?????
  • elseif ???b then
  • ?????
  • elseif
  • End if
  • 4?If ???a then
  • if ???b then
  • ?????
  • else
  • ?????
  • end if
  • else
  • if ???c then
  • ?????
  • else
  • ?????
  • End if
  • End if

???? ???
28
Select case ????
  • Select case ???
  • case ????
  • ?????
  • case ????
  • ?????
  • Case else
  • ????N
  • End select

???? ???
29
For next ??
  • For ??????? to ??? step ???
  • ????
  • next
  • For i1 to 10 step 1
  • for j1 to 10 step 1
  • ????
  • next
  • next

???? ???
30
Do loop??
  • 1?do while ??
  • loop
  • 2?do until ??
  • loop
  • 3?do
  • loop while ??
  • 4?do
  • loop until ??
  • 5?do
  • if ?? then
  • exit do
  • end if
  • loop

???? ???
31
??????
  • ??????
  • Sub name(??1,,??n)
  • End sub
  • ?????
  • Call name(??1,,??n)
  • ?????????????
  • ????????
  • ???,??????????
  • ?????
  • Function name(??1,,??n)
  • name???
  • End function
  • ?????
  • Name(????1,,????n)
  • Vbscript?????
  • ????

???? ???
32
??asp?????
  • Asp???????
  • ???????Request??
  • Response??
  • Cookies???
  • ????

???
33
Asp???????
  • ????,????????????,???????????,????????????????????
    ?????????????(???),???????????????,?????????????
  • Asp????????

34
Asp????????
?? ??
Request ????????
Response ???????????
Session ?????????
Application ??????????????????????
Server ??com???scripting???
35
2????????Request??
  • Request??????????5???
  • 1?form,??????form????????(????)
  • 2?querystring,????????????????
  • 3?cookies,?????????cookies??
  • 4?servervariables,????????????
  • 5?clientcertificate,???????????????

???? ???
36
?????
  • ???????
  • ltform action?????????? methodpostget
    name????gt
  • ??????
  • lt/formgt
  • ????????,???????
  • 1????? 2????? 3?????? 4?????
  • 5???? 6???? 7?????
  • ???????????
  • ???????
  • post ???????????,??????? request(???)
  • get ???????????,??????? request.querystring(
    ???)

???? ???
37
3?Response??
  • Response.write ??????
  • ???lt???/??gt,??????
  • Response.redirect a.htm ?????
  • ?lthtmlgt?????
  • Response.end ?????????
  • Resposne.buffertrue/false ???????????
  • ?lthtmlgt?????

???? ???
38
4?Cookies
  • Cookies?????????,?????WEB???????????????IE????,???
    ????????COOKIES,??IE???,??COOKIES????,????????????
    ????IE???????COOKIES?
  • ????????????cookies?,????????,????????COOKIES?
    ??
  • COOKIES????????
  • ?? response.cookies(name)values
  • ?? ??request.cookies(name)
  • ????cookies?,???????
  • ??????

???? ???
39
5?????
  • ?ASP?????????????????????,??scripting.filesy
    stemobject????
  • Filesystemobject????
  • ???????????????????????????????????????
  • Set ???server.createobject(scripting.filesystemo
    bject)
  • ???????????
  • 1??????
  • Set ???filesystemobject??.createtextfile(
    ??????,????,????)
  • ???????false ???????true?unicode,false?ascII
    ???
  • 2??????
  • filesystemobject??.deletefile( ??????,??????)
  • ?????????false????

40
5?????
  • ????????
  • filesystemobject??.fileexists( ??????)
  • ????????true,????false
  • ??????????
  • ???????????????????,?????server???mappath??,?
    ?web????????????????????
  • server.mappath(??????)
  • ?????
  • ??????????????????
  • Set ???? filesystemobject??.opentextfile(
    ??????,??/????,?????)
  • ??/????1,??(??)?2,??,???????,????8,???
    ?????
  • ?????????false,???????????,?????

41
5?????
  • ????????
  • 1????????
  • ??????.atendofstream
  • ????true??????
  • 2???????
  • ??????.read(n)
  • N???,???????N???
  • 3?????
  • ??????.readline
  • 4?????????
  • ??????.readall

42
5?????
  • 5???????
  • ??????.skip(???????)
  • ??????.skipline ????
  • ???????
  • ??????.write(?????)
  • ??????.writeline(?????)?write????????????????


43
????????
  • ??????ADO??
  • SQL?????
  • ??Recordset??????

???
44
1???????ADO??
  • Asp??????
  • ????????
  • ????????

???? ???
45
Asp??????
  • ASP??????????
  • access?mysql?sqlserver?oracle?
  • Ado??
  • ????PWS/IIS?,??????????ADO??(ACTIVEX DATA
    OBJECT)??ASP????????????????????????ADO???????,???
    ?sql???recordset ????ADO?????????/??/??/????

???? ???
46
??????
  • ??????
  • ????ACCESS??????liuyanban,??liuyan?,???
  • name?????????
  • neirong ????????
  • shijian??????????
  • ?????

???? ???
47
??????????
  • ????ACCESS??????
  • set cnndbsever.createobject(adodb.connection
    )
  • ???????????,????cnndb??????
  • ??????????,????OPEN???????
  • cnndb.open ?????,?????,??
  • 1?????????,????????
  • Providermicrosoft.jet.oledb.4.0data
    source server.mappath(./liuyanban.mdb)
  • 2?????DSN
  • ????DSNcnndb.open liuyanban
  • 3?????DSN
  • ????DSNcnndb.open filedsnserver.mappa
    th(./liuyanban.mdb)
  • 4???DSN???DSN???
  • 98?? ????odbc?????/??DSNmicrosoft
    access drivers??

???? ???
48
?????????
  • Recordset?????
  • Recordset???????????????????????,????
    ?????????????????????,????????????????,???????????
    ??recordset???movefirst(?????)?moveprevious(?????)
    ?movenext(?????)?movelast(??????)?????,???????????
    ??
  • recordset???????
  • set ????server.createobject(adodb.recor
    dset)
  • recordset?????,??open??,???????????????????
  • recordset????.open ???,????,????,????,??
  • ????
  • ????????? ????????connection????
  • ??????recordset???????????????????
  • 0????,?????????????????????,???????,??????

???? ???
49
????
  • 1,???????????????????????????,???????????,????????
    ??????????
  • 2,????????????????????????????
  • 3,????????????????????????????
  • ????
  • 1,??,??????????????????
  • 2,????,?????????,?????
  • 3,????,??????update???,?????
  • 4,???????,?????????
  • ??
  • -1,?????????????????????????
  • 1,?????????????????????
  • 2,????????????????????
  • 3,????????????????????

???? ???
50
?????????
  • ?set cnndbserver.createobject(adodb.connection
    )
  • cnndb.open liuyanban
  • set rstobjserver.createobject(adodb.reco
    rdset)
  • rstobj.open liuyan,cnndb
  • rstobj(name) ?????????
  • do while not rstobj.eof ????????????
  • rstobj.movenext
  • loop
  • rstobj.movelast?????????????
  • do while not rstobj.bof ????????????
  • rstobj.moveprevious
  • loop

???? ???
51
Recordset ????????
  • ????recordset???,??????,??????????,????
  • recordset????.close
  • ????
  • set recordset????nothing

???? ???
52
????????
  • ???????????
  • Recordset????.fields.count ??rstobj.fields.count
  • ?????????????
  • Recordset????.fields(?????).name
    ??rstobj.fields(2).name
  • ???????
  • ??Recordset????.recordcount
  • ?????????
  • ??Recordset????.absoluteposition
  • ????????N???
  • Recordset????.absolutepositionN
  • ?????recordcount ?absoluteposition??,recordset???
    open????????????1?3?

???? ???
53
2? SQL?????
  • Sql????????????????????????????ASP???ADO??????Sql?
    ??????,?????????????????
  • ??ADO???recordset??????????,?????????,????????
    ?sql??,??recordset????????,???????????

???? ???
54
Sql???????
  • connection????.execute(????)
  • ??set cnndbserver.createobject(adodb.connection
    )
  • cnndb.open liuyanban
  • strselect from liuyan ????SQL??
  • cnndb.execute(str) ??SQL??
  • ??recordset???open????select??
  • set cnndbserver.createobject(adodb.connection
    )
  • cnndb.open liuyanban
  • strselect from liuyan ????SQL??
  • rstobj.open str,cnndb

???? ???
55
???????
  • Connection????.execute(????)
  • ??????
  • Insert?update?delete??

???? ???
56
?????select??
  • ???
  • Select ??1 as ????1,??2 as ????2, from
    ???? whereorder by
  • ?????????,where??????????,order by????
  • Where??????????
  • Like??????????
  • ?????????,_?????????,?????????

???? ???
57
?????select??
  • ??????
  • gt,lt,gt,lt,ltgt,,betweenand
  • ??????
  • gt,lt,gt,lt,ltgt,,betweenand
  • Not??? where not ???
  • In??? where ?? in(?1,?2,)???????
  • ??????
  • And ,or
  • Order by ?? asc(??)/desc(??)

???? ???
58
????
  • Insert into ?(??1,??2) values(?1,?2)
  • ???????????????????????
  • values(request(name),)

???? ???
59
???????
  • Delete from ?? where ??
  • Update ?? set ????? where ??
  • ?????????????????

???? ???
60
3???Recordset??????
  • ??recordset????????sql?????????????,?????,????????
    ??????????,?????????????,???????????????
  • ??sql????????????????,?????????????,?recordset???u
    pdate????????????????
  • recordset??.update
  • ??rstobj.open select from liuyan where
    namedd,cnndb,1,2??????
  • rstobj(name)request(name)????
  • rstobj(neirong)request(neirong )
  • rstobj(shijian)request(shijian)
  • rstobj.update ????

???? ???
61
Asp?????
  • ?ASP???????????????????????????,??????????????????
    ??????,????ASP?????????,?????
Write a Comment
User Comments (0)
About PowerShow.com