%if not session("type")="3" then response.Redirect "../login.asp" else %> !--#include file="../conn.asp" --> LINK href="../css/home1.css" type=text/css rel=stylesheet> % set rs=server.CreateObject("ADODB.recordset") sql = "select * from [sushe] where m_su='" request.Form("su") "'" rs.open sql,conn,1,1 if rs.recordcount>0 then response.write("p align='center'>"request.QueryString("name")":" request.Form("su") "已經入庫,請?zhí)砑悠渌?request.QueryString("name")"!") response.Write "a href='xitong_set.asp' target='mainFrame'>繼續(xù)添加/a>/p>" rs.close set rs=nothing conn.close set conn=nothing else rs.close conn.begintrans '開啟事物功能 rs.open "sushe",conn,1,3 rs.addnew '插入數(shù)據(jù)到users表 rs("m_su")=request.Form("su") rs.update rs.close if err.number>0 then conn.begintrans '開啟事物功能 ...中間是一些添加修改刪除操作 如果出現(xiàn)錯誤就取消 conn.rollbacktrans '取消事物更改并結束事物 如果沒問題,就保存 conn.CommitTrans '保存事物并結束事物 response.Write("p align='center'>添加失敗,請重新添加""nbsp;""nbsp;") response.write "a href='xitong_set.asp' target='mainFrame'>重新添加/a>/p>" else conn.CommitTrans '保存事物并結束事物 response.write"SCRIPT language=JavaScript>alert('添加成功!');" response.write"setTimeout(parent.mainFrame.document.location='xitong_set.asp',0)" response.write"/SCRIPT>" end if end if %>