主题:請問如何用一個刪除按鈕刪除兩個數據庫表格內的記錄
請教一下,我用一個表單提交信息分別給數據庫的兩個表格giveme和payjilu
我如果在想用一個刪除按鈕刪除相對應兩個數據庫表格內的記錄應該如何寫呢。
下面這是只刪除giveme記錄的,謝謝
<%
rs.close
end sub
sub del
if session("flag")>1 then
response.Write "<div align=center><font size=80 color=red><b>您没有此项目管理权限!</b></font></div>"
response.End
end if
set rs=conn.execute("select id,m_show,m_id,x_id,m_name,m_phone,m_yudingtime from giveme order by m_yudingtime desc")
%>
<br><br><br>
<table width="95%" border=1 align="center" cellPadding=0 cellSpacing=0 bordercolor="#999999" borderColorDark=#ffffff bgcolor="#F9F9F9"> <tr align="center" bgcolor="#f5f5f5">
<td width="23%" height="24" bgcolor="#f5f5f5">预订人姓名</td>
<td width="31%" height="24" bgcolor="#f5f5f5">预订人联系电话</td>
<td width="15%" height="24" bgcolor="#f5f5f5">预订时间</td>
<td width="11%" height="24" bgcolor="#f5f5f5">线路详情</td>
<td width="12%" height="24" bgcolor="#f5f5f5">预订详情</td>
<td width="8%" height="24" bgcolor="#f5f5f5">删除</td>
</tr>
<%
if rs.eof then
response.write("<tr align=""center""><td height=""24"" colspan=""6"" bgcolor=""#FFFFFF"">暂时没有预订信息!</td></tr>")
end if
while not rs.eof
%>
<tr align="center" bgcolor="#FFFFFF">
<td height="22">
<%if not rs("m_show") then
response.write("<img src=images/mfk34.gif>")
end if
response.write rs("m_name")%></td>
<td><%=rs("m_phone")%></td>
<td><%=rs("m_yudingtime")%></td>
<td><a href="../xl/xl_<%=rs("x_id")%>.html" target="_blank">查看</a></td>
<td><input type="button" value="预订详情" onclick=" window.location='?action=look&id=<%=rs("id")%>'"></td>
<td><input type="button" value="删除" onclick=" window.location='?action=delok&id=<%=rs("id")%>'"></td>
</tr>
<%
rs.movenext
wend
rs.close
%>
</table>
<table width="618" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="4"></td>
</tr>
</table>
<table width="95%" border=1 align="center" cellPadding=0 cellSpacing=0 bordercolor="#999999" borderColorDark=#ffffff bgcolor="#F9F9F9"> <tr>
<td height="35" align="center"><input type="button" name="Submit2" value="刷 新" onclick="window.location.reload();"></td>
</tr>
</table>
<%
end sub
sub delok
if session("flag")>1 then
response.Write "<div align=center><font size=80 color=red><b>您没有此项目管理权限!</b></font></div>"
response.End
end if
dim id
id=trim(request("id"))
conn.execute("delete from giveme where id="&id)
response.write("<script>alert('你选择的预订信息已经删除!按确定重新载入!');window.location='admin_yddel.asp?action=del';</script>")
end sub
%>
我如果在想用一個刪除按鈕刪除相對應兩個數據庫表格內的記錄應該如何寫呢。
下面這是只刪除giveme記錄的,謝謝
<%
rs.close
end sub
sub del
if session("flag")>1 then
response.Write "<div align=center><font size=80 color=red><b>您没有此项目管理权限!</b></font></div>"
response.End
end if
set rs=conn.execute("select id,m_show,m_id,x_id,m_name,m_phone,m_yudingtime from giveme order by m_yudingtime desc")
%>
<br><br><br>
<table width="95%" border=1 align="center" cellPadding=0 cellSpacing=0 bordercolor="#999999" borderColorDark=#ffffff bgcolor="#F9F9F9"> <tr align="center" bgcolor="#f5f5f5">
<td width="23%" height="24" bgcolor="#f5f5f5">预订人姓名</td>
<td width="31%" height="24" bgcolor="#f5f5f5">预订人联系电话</td>
<td width="15%" height="24" bgcolor="#f5f5f5">预订时间</td>
<td width="11%" height="24" bgcolor="#f5f5f5">线路详情</td>
<td width="12%" height="24" bgcolor="#f5f5f5">预订详情</td>
<td width="8%" height="24" bgcolor="#f5f5f5">删除</td>
</tr>
<%
if rs.eof then
response.write("<tr align=""center""><td height=""24"" colspan=""6"" bgcolor=""#FFFFFF"">暂时没有预订信息!</td></tr>")
end if
while not rs.eof
%>
<tr align="center" bgcolor="#FFFFFF">
<td height="22">
<%if not rs("m_show") then
response.write("<img src=images/mfk34.gif>")
end if
response.write rs("m_name")%></td>
<td><%=rs("m_phone")%></td>
<td><%=rs("m_yudingtime")%></td>
<td><a href="../xl/xl_<%=rs("x_id")%>.html" target="_blank">查看</a></td>
<td><input type="button" value="预订详情" onclick=" window.location='?action=look&id=<%=rs("id")%>'"></td>
<td><input type="button" value="删除" onclick=" window.location='?action=delok&id=<%=rs("id")%>'"></td>
</tr>
<%
rs.movenext
wend
rs.close
%>
</table>
<table width="618" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="4"></td>
</tr>
</table>
<table width="95%" border=1 align="center" cellPadding=0 cellSpacing=0 bordercolor="#999999" borderColorDark=#ffffff bgcolor="#F9F9F9"> <tr>
<td height="35" align="center"><input type="button" name="Submit2" value="刷 新" onclick="window.location.reload();"></td>
</tr>
</table>
<%
end sub
sub delok
if session("flag")>1 then
response.Write "<div align=center><font size=80 color=red><b>您没有此项目管理权限!</b></font></div>"
response.End
end if
dim id
id=trim(request("id"))
conn.execute("delete from giveme where id="&id)
response.write("<script>alert('你选择的预订信息已经删除!按确定重新载入!');window.location='admin_yddel.asp?action=del';</script>")
end sub
%>