% For i = 1 to rs.PageSize '利用for next 循環(huán)依次讀出當(dāng)前頁的記錄 if rs.EOF then Exit For end if response.write("a href=change.asp?id=" rs("cn_id") ">修改/a>") response.write("文章標(biāo)題是:" rs("cn_title")) response.write("br>文章作者是:" rs("cn_author")) response.write("br>文章加入時間是:" rs("cn_time")) response.write("br>文章內(nèi)容是:" rs("cn_content")) response.write("hr>") rs.MoveNext Next %> |
!--#include file="conn.asp" --> % id=request.querystring("id") %> %if request.form("submit")="change" then whattitle=request.form("title") whoauthor=request.form("author") whatcontent=request.form("content") id=request.form("id") Set rs = Server.CreateObject ("ADODB.Recordset") sql = "Select * from cnarticle where cn_id="id rs.Open sql,conn,3,2 rs("cn_title")=whattitle rs("cn_author")=whoauthor rs("cn_content")=whatcontent rs.update rs.close Set rs = Nothing conn.close set conn=Nothing response.redirect("showit.asp") response.end %> %end if%> % if id>"" then Set rs = Server.CreateObject ("ADODB.Recordset") sql="select * from cnarticle where cn_id="id rs.Open sql,conn,1,1 whattitle=rs("cn_title") whoauthor=rs("cn_author") whatcontent=rs("cn_content") end if %> form action="change.asp" method="post"> Title:input type="text" name="title" value=%=whattitle%>>br> Author:input type="text" name="author" value=%=whoauthor%>>br> Content:br> textarea name="content" rows="8" cols="30">%=whatcontent%>/textarea>br> input type="submit" value="change" name="submit"> input type="reset" value="Reset"> input name="id" type="hidden" value="%=id%>"> /form> |
%if request.form("submit")="change" then whattitle=request.form("title") whoauthor=request.form("author") whatcontent=request.form("content") id=request.form("id") sql = "update cnarticle set cn_title='"whattitle"',cn_author='"whoauthor"',cn_content='"whatcontent"' where cn_id="id conn.Execute(sql) conn.close set conn=Nothing response.redirect("showit.asp") response.end %> |
標(biāo)簽:四平 平頂山 遼陽 馬鞍山 防城港 湖北 孝感 朝陽
巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《ASP編程入門進階(二十):ADO組件之修改數(shù)據(jù)記錄》,本文關(guān)鍵詞 ASP,編程,入門,進階,二十,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。