asp 删除记录 (在线等)
<divclass="renew_2">信息:<p>名称:<inputtype="text"name="txt_1"id="txt"/></p></div><%conn....
<div class="renew_2">信息:
<p>名称:<input type="text" name="txt_1" id="txt" /></p>
</div>
<%
conn.begintrans
set rst=server.CreateObject("adodb.recordset")
on error resume next
rst.open "select * from aa where aa='"&request.Form("txt_1")& "'" ,conn,1,3
rst.delete
rst.close
if err.number<>0 then
conn.rollbacktrans
response.Write("chenggong")
else
conn.committrans
response.Write("shibai")
end if
%>
<div id="buttom">
<input type="submit" value="删除" />
</div>
</form >
帮我改一下代码,实现在"txt_1"为空或数据库无此信息时提示无删除信息,否则按删除按钮删除信息,然后提示删除成功或失败
急啊。。先谢谢了 展开
<p>名称:<input type="text" name="txt_1" id="txt" /></p>
</div>
<%
conn.begintrans
set rst=server.CreateObject("adodb.recordset")
on error resume next
rst.open "select * from aa where aa='"&request.Form("txt_1")& "'" ,conn,1,3
rst.delete
rst.close
if err.number<>0 then
conn.rollbacktrans
response.Write("chenggong")
else
conn.committrans
response.Write("shibai")
end if
%>
<div id="buttom">
<input type="submit" value="删除" />
</div>
</form >
帮我改一下代码,实现在"txt_1"为空或数据库无此信息时提示无删除信息,否则按删除按钮删除信息,然后提示删除成功或失败
急啊。。先谢谢了 展开
展开全部
<%
conn.begintrans
set rst=server.CreateObject("adodb.recordset")
on error resume next
rst.open "select * from aa where aa='"&request.Form("txt_1")& "'" ,conn,1,3
if not (rst.eof and rst.bof) then
rst.delete
rst.close
if err.number<>0 then
conn.rollbacktrans
response.Write("chenggong")
else
conn.committrans
response.Write("shibai")
end if
else
rst.close
response.Write("未找到记录")
end if
%>
conn.begintrans
set rst=server.CreateObject("adodb.recordset")
on error resume next
rst.open "select * from aa where aa='"&request.Form("txt_1")& "'" ,conn,1,3
if not (rst.eof and rst.bof) then
rst.delete
rst.close
if err.number<>0 then
conn.rollbacktrans
response.Write("chenggong")
else
conn.committrans
response.Write("shibai")
end if
else
rst.close
response.Write("未找到记录")
end if
%>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询