《Web數(shù)據(jù)庫技術(shù)(第二版)》第9章:ADOCom匯總_第1頁
《Web數(shù)據(jù)庫技術(shù)(第二版)》第9章:ADOCom匯總_第2頁
已閱讀5頁,還剩9頁未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、Web數(shù)據(jù)庫技術(shù)教程2第9章ADO Command對(duì)象律立Command對(duì)象O利用己創(chuàng)建的Connection對(duì)象建立Command對(duì)象Web數(shù)據(jù)庫技術(shù)教程9 ADO Command對(duì)象律立Command對(duì)象(續(xù))O單獨(dú)建立Command對(duì)象9 ADO Command對(duì)象Web數(shù)據(jù)炸技術(shù)教程執(zhí)行Command對(duì)象El使用Command對(duì)象的Execute方法執(zhí)行CommandText指定的查詢:Web數(shù)據(jù)庫技術(shù)教程9 ADO Command對(duì)象執(zhí)行Command對(duì)象(續(xù))冋使用Recordset對(duì)象的Open方法執(zhí)彳亍CommandText指定 的查詢:9 ADO Command對(duì)象Web數(shù)據(jù)

2、庫技術(shù)教程6Command對(duì)象的屬性ActiveConnection屬性:指出 勺前Command對(duì)象所連 接的Connection對(duì)象E CommandText性:設(shè)置或返回對(duì)數(shù)據(jù)提供者的查詢 串 CommandTimeout屬性:設(shè)置執(zhí)行一個(gè)Command對(duì)象 時(shí)等待的秒數(shù)El CommandType性:指Hl Command對(duì)象的類型Web數(shù)據(jù)庫技術(shù)教租9 ADO Command對(duì)象E3 Prepared屬性:指出在調(diào)川Command對(duì)象的Exec ule方 法時(shí),是否將查詢的編譯結(jié)杲存儲(chǔ)下來,這是一個(gè)布 爾類型的值Coinnand對(duì)象的;性(續(xù))9 ADO Command對(duì)象Web數(shù)據(jù)

3、庫技術(shù)教程8Command對(duì)象的方法 Cancel方法:取消一個(gè)未確定的異步執(zhí)行的Execute方 法。其語法為:Command.CancelWeb數(shù)據(jù)庫技術(shù)教程9 ADO Command對(duì)象Command對(duì)象的方法(續(xù))CreateParameter方法:以指定的屬性創(chuàng)建一個(gè)新的Parameter對(duì)象。其語法為:Set Parameter =Command.CreateParameter(Name,Type,Direction,Size,Value)Command對(duì)象的方法(續(xù))EExecute方法: 執(zhí)行一個(gè)lIlCommandText屬性指定的 查詢、SQL9 ADO Command對(duì)象

4、Web數(shù)據(jù)庫技術(shù)教程10語句或者存儲(chǔ)過程。 其語法對(duì)于一個(gè)有返 回記錄的Command和一個(gè)沒有返回記錄的Command有所不同Web數(shù)據(jù)庫技術(shù)教程99 ADO Command對(duì)象Command對(duì)象的使用例 9 1 login.htm 訪客登記 姓名: f fi7:9 ADO Command對(duì)象Web數(shù)據(jù)庫技術(shù)教程12 JtliS:1另 tdxinputtype=radioname= sexvalue= 9Jvb 地址: pxinput type=submit name=submit value=提交Web數(shù)據(jù)庫技術(shù)教程9 ADO Command對(duì)象Comuand對(duì)象的使用(續(xù))Comuand

5、對(duì)象9 ADO Command對(duì)象Web數(shù)據(jù)庫技術(shù)教程區(qū) 例 9-2write.asp% languageVBSCRIPT” 訪客登 id Web數(shù)據(jù)庫技術(shù)教程9 ADO Command對(duì)象 姓名: 年齡: 電話:性另 0:tdxinput type=radio nime=,sexnvalue=J女 yjCoiiiiiand對(duì)象的使用(續(xù))13Comuand對(duì)象9 ADO Command對(duì)象Web數(shù)據(jù)庫技術(shù)教程16Command對(duì)象的使用(續(xù))地址: Web數(shù)據(jù)庫技術(shù)教程159 ADO Command對(duì)象Command對(duì)象的使用(續(xù))%if Request.form(MnameH) then

6、name=Request.form(,nameM)response.write” 姓名:& name elseresponse, write 您沒有輸入姓名Hend ifif Request.form(nphoneH) o ,nthen phone=Request.form(HphoneM)response.write 電話:H& phone elseresponse.write” 您沒有輸入電話號(hào)碼 end if9 ADO Command對(duì)象Web數(shù)據(jù)庫技術(shù)教程18Command對(duì)象的使用(續(xù))if Request.formCage) then age=Request.form(Mage)r

7、esponse.write 年齡:H& ageelseresponse, write” 您沒有輸入年齡” end ifresponse.writeHM:WJ:n& Request.fomi(MsexH)sex=Request.form(nsexM) if sex then sex = sexWeb數(shù)據(jù)庫技術(shù)教程9 ADO Command對(duì)象if Request.form(naddrH) ,nthen addr=Request.fomi(naddrH)response.writen 地址:” & Request.form(HaddrH) elseresponse, write 您沒有輸入地址en

8、d ifresponse.write 謝謝您的光臨!17Coinnand對(duì)象9 ADO Command對(duì)象Web數(shù)據(jù)庫技術(shù)教程20set cm = Server.CreateObject(HADODB.Commandn)setcn=Server.CreateObject(nADODB.ConnectionM)cn.open,driver= Microsoft Access Drived*.mdb);DBQ=H& Server.MapPath(Htest.mdbM)cm ActiveConneclion=cncm.CommandText=HINSERT INTOperson(name,sex,a

9、ge,addr,phone)H&”YALUES(?,?,?,?,?)Set ob j Param=cm.CreateParameter(,201, ,255, name)cm. Parameters.Appendobj ParamSet ob j Param=cm.CreateParameter(,201, ,255, sex)cm. Parameters. Append obj ParamWeb數(shù)據(jù)庫技術(shù)教程9 ADO Command對(duì)象Command對(duì)象的使用(續(xù))Set objParam=cm.CreatcParamcter(,201, ,255, age) cm. Parameters

10、.Append obj ParamSet objParam=cm.CreateParameter(,201, ,255, addr) c m Parameters Append obj ParamSet obj Param=cm.CreateParameter(,2015,255, phone) cm.Parameters. Append obj Paramcm.Execute%Comuand對(duì)象199 ADO Command對(duì)象Web數(shù)據(jù)庫技術(shù)教程22Command對(duì)象的使用(續(xù))Web數(shù)據(jù)庫技術(shù)教程9 ADO Command對(duì)象Command對(duì)象的使用(續(xù))例 9-3read.asp% l

11、anguageVBSCRIPT” 讀訪客登記表 %set cm = Server.CreateObject(nADODB.Command,r)set cn=Server.CreateObject(nADODB.Connection1)cn.openndriver= Microsoft Access Drived*.mdb);DBQ=n&Server.MapPath(ntest.mdbn)cm. ActiveConnection=cncm. CommandText=HpersonH219 ADO Command對(duì)象Web數(shù)據(jù)庫技術(shù)教程23set rs=c m. Execute9 ADO Comm

12、and對(duì)象Web數(shù)據(jù)庫技術(shù)教程24if rs.eofthenresponse.write 沒有查到記錄 elsedo while not rs.eofresponse.writenH&Hu& rs(Fame”) &Fb&”nresponse, write”地址:& rs(HaddrH)&”nresponse.write1* 電話:& rs(HphoneH)&H urs.movenextloopend ifrs.closeset rs=nothing%Web數(shù)據(jù)庫技術(shù)教程239 ADO Command對(duì)象 i訪客Sf回 ft -Kier”。Internet Explorer文件E)收卒 工員4bQ)4J6il地址|J http /locilhoit/rtwd. up三Q 轉(zhuǎn)封 饉按張有為 地址:天山路1024號(hào)302室11223344-李甌:淸 地址:黃河南路12#14號(hào)1106室 段話M12

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論