| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1576 人关注过本帖
标题:程序能实现单表删除,多表查询,要怎么实现多表删除
只看楼主 加入收藏
yangfeng_8
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2010-10-24
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:14 
程序能实现单表删除,多表查询,要怎么实现多表删除
请朋友帮看一下怎么改。这是查询和删除程序,要实现多表删除怎么改,最后面 是删除代码。
<%
    dim strFileName
    dim i,j
    dim szTitle
    dim strSQL,rsObj
    dim szTypeName
    dim strAdmin,arrAdmin
    dim nTypeId
    dim CurrentPage

    strFileName="ProductList.asp?TypeId=" & nTypeId

    szTitle=RealString(Request.Form("Title"))                '医药名称
    nTypeId = RealString(Request.Querystring("typeId"))        '医药类型ID
    CurrentPage = RealString(Request.QueryString("page"))    '当前页面
    '判断是否为数字
    if Not IsNumeric(CurrentPage)  then
        currentPage=1
    end if

    '组织SQL语句
    strSQL="SELECT * FROM  ja_1 "
   
   
   
   
    strSQL = strSQL & " WHERE ja_1.id  = ja_1.id"
   
   
   
   
    if szTitle<>"" then        '如果药品名称过滤条件不为空
        strSQL=strSQL & " and [Name] like '%" & szTitle & "%' "
    end if
    if IsNumeric(nTypeId) then        '如果药品类型编号正确
        strSQL=strSQL & " and Product.TypeId=" & nTypeId
    else
        nTypeId = "0"    '初始化
    end if
    strSQL=strSQL & " order by ID desc"
    '
    Set rsObj= Server.CreateObject("ADODB.RecordSet")
    rsObj.Open strSQL,conn,2,1
    if not rsObj.EOF then
        rsObj.PageSize = conMaxPerPage_Default
    end if   

%>



<SCRIPT language=javascript>
function unselectall()
{
    if(document.del.chkAll.checked){
    document.del.chkAll.checked = document.del.chkAll.checked&0;
    }     
}

function CheckAll(Form)
  {
  for (var i=0;i<Form.elements.length;i++)
    {
    var e = Form.elements[i];
    if (e.Name != "chkAll")
       e.checked = Form.chkAll.checked;
    }
  }
function ConfirmDel()
{
   if(confirm("您确定要删除吗?"))
     return true;
   else
     return false;
     
}

</SCRIPT>










<%
BookName = Trim(Request("BookName"))
BookType = Trim(Request("BookType"))
Author = Trim(Request("Author"))
BookPub = Trim(Request("BookPub"))

BookPub2 = Trim(Request("BookPub2"))



PubYear = Trim(Request("Year"))
PubMonth = Trim(Request("Month"))
PageCompare = Trim(Request("PageCompare"))
Pages = Trim(Request("Pages"))
PriceCompare = Trim(Request("PriceCompare"))
Price = Trim(Request("Price"))

dim pageparameters



pageparameters = "ja_1.asp"





pageparameters = pageparameters& "?BookName="&BookName
pageparameters = pageparameters& "&BookType="&BookType
pageparameters = pageparameters& "&Author="&Author
pageparameters = pageparameters& "&BookPub="&BookPub

pageparameters = pageparameters& "&BookPub2="&BookPub2



pageparameters = pageparameters& "&Year="&PubYear
pageparameters = pageparameters& "&Month="&PubMonth
pageparameters = pageparameters& "&PageCompare="&PageCompare
pageparameters = pageparameters& "&Pages="&Pages
pageparameters = pageparameters& "&PriceCompare="&PriceCompare
pageparameters = pageparameters& "&Price="&Price

dim PageIndex

PageIndex = cint (request("PageIndex"))
if PageIndex =<"1" then
    PageIndex = 1
end if

if (BookType = "")then
    Flag = True
Else
    Flag = False
end if






StrSql = ""




If bookPub <> "" Then
  If Trim(StrSql & " ") = "" Then
     StrSql = "  (not ID like '%" &BookPub& "%') and   (not MusicName like '%" &BookPub& "%' ) and   (not SingerName like '%" &BookPub& "%' ) and   (not CanDu like '%" &BookPub& "%' ) and   (not MusicType like '%" &BookPub& "%' ) and   (not TueiJian like '%" &BookPub& "%' ) and   (not FileName like '%" &BookPub& "%' ) and   (not FileSize like '%" &BookPub& "%' ) and   (not FileExt like '%" &BookPub& "%' ) and   (not Remark like '%" &BookPub& "%' )"
         

  Else
     StrSql = StrSql & "(not ID like '%" &BookPub& "%') and   (not MusicName like '%" &BookPub& "%' ) and   (not SingerName like '%" &BookPub& "%' ) and   (not CanDu like '%" &BookPub& "%' ) and   (not MusicType like '%" &BookPub& "%' ) and   (not TueiJian like '%" &BookPub& "%' ) and   (not FileName like '%" &BookPub& "%' ) and   (not FileSize like '%" &BookPub& "%' ) and   (not FileExt like '%" &BookPub& "%' ) and   (not Remark like '%" &BookPub& "%' )"
  End If
  
  End If



If BookName <> "" then
StrSql = "(ID like '%" &BookName&"%') or (MusicName like '%" &BookName&"%') or (SingerName like '%" &BookName&"%') or (CanDu like '%" &BookName&"%') or (MusicType like '%" &BookName&"%') or (TueiJian like '%" &BookName&"%') or (FileName like '%" &BookName&"%') or (FileSize like '%" &BookName&"%') or (FileExt like '%" &BookName&"%') or (Remark like '%" &BookName&"%')" '或指向数据库表一个或多个字段,查找时可以查出数据表字段的内容。如在(MusicName like '%" &BookName&"%')加上or (SingerName like '%" &BookName&"%')

 end if

If BookType <> "全部" Then
    If Trim(StrSql & " ") = "" Then
            StrSql = " Remark ='" & BookType& "'"    '种类(调制数据表里的字段种类,如数据表里的字段为A,B,C,那种类先时会有A,B,C)
  Else
            StrSql = StrSql & " and Remark ='" & BookType& "'"
            
  End If
End If







   
If Author <> "" Then
  If Trim(StrSql & " ") = "" Then
     StrSql = " MusicName like '%" &Author& "%'"
  Else
     StrSql = StrSql & " and MusicName like '%" &Author& "%'"
  End If
End If
   
  




   






   
If PubYear <> "" Then
   PubDate = CDate(PubYear & "-" & PubMonth & "-01")
   If Trim(StrSql & " ") = "" Then
      StrSql = " TueiJian = #" & PubDate & "#"
   Else
      StrSql = StrSql & " and TueiJian = #" & PubDate & "#"
   End If
End If
  
If Pages<> "" Then
    If Trim(StrSql & "") = "" Then
       StrSql = "ID "& PageCompare &" "&CInt(Pages)&""
    Else
        StrSql = StrSql & " and ID "& PageCompare &" "&CInt(Pages)&""
    End If
End If

If Price<> "" Then
    If Trim(StrSql & "") = "" Then
       StrSql = "FileSize "& PriceCompare &" "&CCur(Price)&""
    Else
        StrSql = StrSql & " and FileSize "& PriceCompare &" "&CCur(Price)&""
    End If
End If



If bookPub2 <> "" Then
  If Trim(StrSql & " ") = "" Then
     StrSql = " (ID like '%" &BookPub2& "%') or (MusicName like '%" &BookPub2& "%') or (SingerName like '%" &BookPub2& "%') or (CanDu like '%" &BookPub2& "%') or (MusicType like '%" &BookPub2& "%') or (TueiJian like '%" &BookPub2& "%') or (FileName like '%" &BookPub2& "%') or (FileSize like '%" &BookPub2& "%') or (FileExt like '%" &BookPub2& "%') or (Remark like '%" &BookPub2& "%') "
  Else
     StrSql = StrSql & "or (ID like '%" &BookPub2& "%') or (MusicName like '%" &BookPub2& "%') or (SingerName like '%" &BookPub2& "%') or (CanDu like '%" &BookPub2& "%') or (MusicType like '%" &BookPub2& "%') or (TueiJian like '%" &BookPub2& "%') or (FileName like '%" &BookPub2& "%') or (FileSize like '%" &BookPub2& "%') or (FileExt like '%" &BookPub2& "%') or (Remark like '%" &BookPub2& "%')"
  End If
End If






%>



<%
Dim Rs1
Dim Rs1_numRows

Set Rs1 = Server.CreateObject("ADODB.Recordset")
Rs1.ActiveConnection = MM_JCSP_STRING
Rs1.Source = "SELECT Distinct Remark  FROM (select *  FROM ja_1 )"

'意思是多个数据表的种类选择 如 ),在查找中一般种类不指一个字段,如有多个数据表就按这方法设制,在多个数据表里的字段一定要想同如(SingerName)要相同,要在每个数据表里都有这个字段,这个表示种类的字段

Rs1.CursorType = 1
Rs1.CursorLocation = 2
Rs1.LockType = 1
Rs1.Open()

Rs1_numRows = 0
%>




<%
if Flag=False then
    Dim Rs2
    Dim Rs2_numRows

    Set Rs2 = Server.CreateObject("ADODB.Recordset")
    Rs2.ActiveConnection = MM_JCSP_STRING
    if Trim(StrSql)<>"" then
        Rs2.Source = "select * from (select * from ja_1 )  where "&StrSql
         
        '多个数据_1 )
    else
        Rs2.Source = "SELECT *  FROM jA_1 union all select *  FROM JB_1"
        '这为多个数据写

    Rs2.CursorType = 1
    Rs2.LockType = 1
    'Rs2.CursorLocation = 2
    Rs2.Open()

    Rs2_numRows = 0
end if
%>
<%
Dim Repe1__numRows
Dim Repe1__index

Repe1__numRows = 5
Repe1__index = 0
Rs2_numRows = Rs2_numRows + Repe1__numRows
%>
<%
BookName = Trim(Request("BookName"))
BookType = Trim(Request("BookType"))
Author = Trim(Request("Author"))
BookPub = Trim(Request("BookPub"))
PubYear = Trim(Request("Year"))
PubMonth = Trim(Request("Month"))
PageCompare = Trim(Request("PageCompare"))
Pages = Trim(Request("Pages"))
PriceCompare = Trim(Request("PriceCompare"))
Price = Trim(Request("Price"))



if (BookType = "")then
    Flag = True
Else
    Flag = False
end if



StrSql = ""
If BookName <> "" then
    StrSql = "MusicName like '%" &BookName&"%'"
end if

If BookType <> "全部" Then
    If Trim(StrSql & " ") = "" Then
            StrSql = " Remark ='" & BookType& "'"
  Else
            StrSql = StrSql & " and Remark ='" & BookType& "'"
  End If
End If
   
If Author <> "" Then
  If Trim(StrSql & " ") = "" Then
     StrSql = " SingerName like '%" &Author& "%'"
  Else
     StrSql = StrSql & " and SingerName like '%" &Author& "%'"
  End If
End If
   
If bookPub <> "" Then
  If Trim(StrSql & " ") = "" Then
     StrSql = " CanDu like '%" &BookPub& "%'"
  Else
     StrSql = StrSql & " and CanDu like '%" &BookPub& "%'"
  End If
End If
   
If PubYear <> "" Then
   PubDate = CDate(PubYear & "-" & PubMonth & "-01")
   If Trim(StrSql & " ") = "" Then
      StrSql = " bookPubDate = #" & PubDate & "#"
   Else
      StrSql = StrSql & " and bookPubDate = #" & PubDate & "#"
   End If
End If
   
If Pages<> "" Then
    If Trim(StrSql & "") = "" Then
       StrSql = "bookPages "& PageCompare &" "&CInt(Pages)&""
    Else
        StrSql = StrSql & " and bookPages "& PageCompare &" "&CInt(Pages)&""
    End If
End If

If Price<> "" Then
    If Trim(StrSql & "") = "" Then
       StrSql = "Price "& PriceCompare &" "&CCur(Price)&""
    Else
        StrSql = StrSql & " and Price "& PriceCompare &" "&CCur(Price)&""
    End If
End If

%>
<html>
<head>
<title>查询书籍</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="Style.css" rel="stylesheet" type="text/css">
<script type="text/JavaScript">
<!--

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->
</script>
</head>
<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" Class="border">
  <tr class="topbg">
    <td height="22" colspan=4 align=center><strong>新 闻 中 心</strong></td>
  </tr>
  <form name="Query" action="ja_1.asp" method="Post">
    <tr class="tdbg">
      <td width="131" height="14"><strong>综合查询:</strong></td>
      <td width="544" height="-2"><input name="BookName" type="text" id="BookName" size="50"></td>
      <td width="130" height="-2"><strong>反向查询:</strong></td>
      <td width="446"><input name="BookPub" type="text" id="BookPub" size="50"></td>
    </tr>
    <tr class="tdbg">
      <td height="15"><strong>名称查询:</strong></td>
      <td height="0"><input name="Author" type="text" id="Author" size="50"></td>
      <td height="0"><strong>组合查询:</strong></td>
      <td height="0"><input name="BookPub2" type="text" id="BookPub2" size="50">
         </td>
    </tr>
    <tr class="tdbg">
      <td height="14"><strong>更新日期:</strong></td>
      <td>
        <input name="Year" type="text" id="Year" size="6"> 年
        <select name="Month" id="Month">
        <option value="1">1</option>
        <option value="2">2</option>
                <option value="3">3</option>
                <option value="4">4</option>
                <option value="5">5</option>
                <option value="6">6</option>
                <option value="7">7</option>
                <option value="8">8</option>
                <option value="9">9</option>
                <option value="10">10</option>
                <option value="11">11</option>
                <option value="12">12</option>
       </select>
        月     查 询:每月1号的更新</td>
      <td><strong>种  类</strong><strong>:</strong></td>
      <td><select name="BookType" id="BookType">
        <option value="全部" selected>全部</option>
        <%
While (NOT Rs1.EOF)
%>
        <%
  Rs1.MoveNext()
Wend
If (Rs1.CursorType > 0) Then
  Rs1.MoveFirst
Else
  Rs1.Requery
End If
%>
        <%
While (NOT Rs1.EOF)
%>
        <option value="<%=(Rs1.Fields.Item("Remark").Value)%>"><%=(Rs1.Fields.Item("Remark").Value)%></option>
        <%
  Rs1.MoveNext()
Wend
If (Rs1.CursorType > 0) Then
  Rs1.MoveFirst
Else
  Rs1.Requery
End If
%>
      </select></td>
    </tr>
    <tr class="tdbg">
      <td height="15"><strong>记录数值:</strong></td>
      <td height="0" colspan="3">
          <select name="PageCompare" id="PageCompare">
            <option value="&gt;=" selected>大于</option>
            <option value="=">等于</option>
            <option value="&lt;=">小于</option>
          </select>
          <input name="Pages" type="text" id="Pages" size="10"></td>
    </tr>
    <tr class="tdbg">
      <td height="-1"><strong>文件大小:</strong></td>
      <td height="-1">
        <select name="PriceCompare" id="PriceCompare">
          <option value="&gt;=">大于</option>
          <option value="=">等于</option>
          <option value="&lt;=">小于</option>
        </select>
        <input name="Price" type="text" id="Price" size="10"></td>
      <td height="-1"><strong>查询选项:</strong></td>
      <td height="-1" class="tdbg"><table width="100%" border="0" cellspacing="0">
  <tr>
    <td><input name="Author" type="checkbox" id="Author" value="checkbox">
名称查询</td>
    <td><input name="BookPub" type="checkbox" id="BookPub" value="checkbox">
反向查询</td>
    <td><input name="BookPub2" type="checkbox" id="BookPub2" value="checkbox">
组合查询</td>
  </tr>
</table></td>
    </tr>
    <tr class="tdbg">
      <td height="20" colspan="4"><div align="center">
        
          <input type="submit" name="Submit" value="提交">
           
 <input type="reset" name="Submit" value="重置">
      </div></td>
    </tr>
  </form>
</table>
<br>      
<%
If Flag = False then
%>
<table width='100%' border="0" align="center" cellpadding="0" cellspacing="0" onfocus="MM_goToURL('parent','../indexYCGD.files/Untitled-3.asp');return document.MM_returnValue">
  <tr>
    <td><% If Not Rs2.EOF Or Not Rs2.BOF Then %>
<%
  rs2.pagesize = 2 '每页记录数
  if PageIndex > rs2.pagecount then
      PageIndex = rs2.pagecount
  elseif PageIndex <1 then
        PageIndex = 1  
  end if  
  'response.write PageIndex
  rs2.AbsolutePage = PageIndex
  %>
   &nbsp;
        <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
<%
for i=1 to rs2.pagesize
    if rs2.eof or rs2.bof then
        exit for
    end if
%>
            <tr class="tdbg" onMouseOut="this.style.backgroundColor=''" onMouseOver="this.style.backgroundColor='#BFDFFF'">
              <td align="center"><table width="76%" height="19%" border="0" cellpadding="0" cellspacing="0" class="border">
                <tr>
                  <td width="1256" height="87" align="center" valign="top"><table width="100%" height="125" border="0" cellpadding="0" cellspacing="2" bgcolor="#86BBF7" class="border">
                  
                  
                      <form name="del" method="Post" action="ja_1ProductDel.asp" onSubmit="return ConfirmDel();">
                     
                     
                        <tr>
                          <td width="1251" height="119" ><table width="100%" border="0" cellpadding="0" cellspacing="2" class="border" style="word-break:break-all">
                              <tr bgcolor="#86BBF7" class="title">
                                <td width="44" height="25" align="center"><strong>选 中</strong></td>
                                <td width="56"  height="25" align="center" bgcolor="#86BBF7"><strong>ID</strong></td>
                                <td width="116" align="center" bgcolor="#86BBF7"><strong>名 称</strong></td>
                                <td width="118" align="center" bgcolor="#86BBF7" ><strong>演 员</strong></td>
                                <td width="95" align="center" bgcolor="#86BBF7" ><strong>公 司 </strong></td>
                                <td width="90" align="center" bgcolor="#86BBF7" ><strong>语 言</strong></td>
                                <td width="84" align="center" bgcolor="#86BBF7" ><strong>上传名</strong></td>
                                <td width="78" align="center" bgcolor="#86BBF7" ><strong>扩展名</strong></td>
                                <td width="84" align="center" bgcolor="#86BBF7" ><strong>文件大小</strong></td>
                                <td width="144" align="center" bgcolor="#86BBF7" ><strong>更新时间</strong></td>
                                <td align="center" bgcolor="#86BBF7" ><strong>播 放</strong></td>
                                <td width="83" align="center" bgcolor="#86BBF7" ><strong>下 载</strong></td>
                                <td width="59" align="center" bgcolor="#86BBF7" ><strong>修 改</strong></td>
                                <td colspan="2" align="center" ><strong>删 除</strong><strong></strong></td>
                              </tr>
                              <%
        i=0
        do while not rsObj.eof %>
                              <%
While ((Repe1__numRows <> 0) AND (NOT Rs2.EOF))
%>
                                <tr class="tdbg">
                                  <td width="44" height="22" align="center" bgcolor="#86BBF7"><input name='ProductID' type='checkbox' onClick="unselectall()" id="ProductID" value='<%=cstr(rs2("ID"))%>'>                                </td>
                                  <td width="56" align="center" bgcolor="#D5E3FD"><%=(Rs2.Fields.Item("ID").Value)%></td>
                                  <td width="116" align="center" bgcolor="#D5E3FD"><%=(Rs2.Fields.Item("MusicName").Value)%></td>
                                  <td width="118" align="center" bgcolor="#D5E3FD"><%=(Rs2.Fields.Item("SingerName").Value)%></td>
                                  <td width="95" align="center" bgcolor="#D5E3FD"><%=(Rs2.Fields.Item("CanDu").Value)%></td>
                                  <td align="center" bgcolor="#D5E3FD"><%=(Rs2.Fields.Item("MusicType").Value)%></td>
                                  <td align="center" bgcolor="#D5E3FD"><%=(Rs2.Fields.Item("FileName").Value)%></td>
                                  <td align="center" bgcolor="#D5E3FD"><%=(Rs2.Fields.Item("FileExt").Value)%></td>
                                  <td align="center" bgcolor="#D5E3FD"><%=(Rs2.Fields.Item("FileSize").Value)%></td>
                                  <td align="center" bgcolor="#D5E3FD"><%=(Rs2.Fields.Item("TueiJian").Value)%></td>
                                  <td width="99" align="center" bgcolor="#D5E3FD"><a href="../JCSP/A_N/A/play1/Play.asp?id=<%=(Rs2.Fields.Item("ID").Value)%>" target="_blank"><%=(Rs2.Fields.Item("Play_1").Value)%></a><a href="../JCSP/A_N/A/play1/Download.asp?id=<%=(Rs2.Fields.Item("ID").Value)%>" target="_blank"><%=(Rs2.Fields.Item("Play_2").Value)%></a><%=(Rs2.Fields.Item("Play_3").Value)%><%=(Rs2.Fields.Item("Play_4").Value)%></td>
                                  <td align="center" bgcolor="#D5E3FD"><%=(Rs2.Fields.Item("XZ_1").Value)%><%=(Rs2.Fields.Item("XZ_2").Value)%><a href="../JCSP/A_N/A/play1/admin/readdbfile.asp?FileID=<%=(Rs2.Fields.Item("ID").Value)%>"><%=(Rs2.Fields.Item("ZTXZ").Value)%></a></td>
                                  <td align="center" bgcolor="#D5E3FD"><a href="../JCSP/A_N/A/play1/admin/XGYM.asp?id=<%=(Rs2.Fields.Item("ID").Value)%>">修改</a></td>
                                  <td width="57" align="center" bgcolor="#D5E3FD"><a href="ProductModify.asp?ProductID=<%=rs2("ID")%>"></a> <a href="ja_1ProductDel.asp?ProductID=<%=rs2("ID")%>&Action=Del" onClick="return ConfirmDel();">删除</a> </td>
                                </tr>
                                <%
  Repe1__index=Repe1__index+1
  Repe1__numRows=Repe1__numRows-1
  Rs2.MoveNext()
Wend
%>

                              <%
            i=i+1
            if i>=conMaxPerPage_Default then exit do
            rsObj.movenext
        loop
        %>
                            </table>
                              <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                  <td width="738" height="30"><input name="chk_all" type="checkbox" id="chk_all" value="checkbox" onClick="CheckAll(this.form.ProductID,this.form.chk_all)">
                                    [全选/反选]
                                  <style>
.white{color:#FFFFFF; font-weight:bold}
                </style></td>
                                  <td width="64"><input name="Submit1" type="button" id="Submit1" onClick="MM_goToURL('parent','../../WEB/ADO_recordset.asp');return document.MM_returnValue" value="WEB 数据"></td>
                                  <td width="64"><input name="Submit2" type="button" onClick="MM_goToURL('parent','../JCSP/A_N/A/play1/admin/UptoDB.asp');return document.MM_returnValue" value="添加上传"></td>
                                  <td width="64" align="right"><input name="submit" type='submit' value='删除选定' >
                                  <input name="Action" type="hidden" id="Action" value="Del"></td>
                                </tr>
                          </table></td>
                        </tr>
                      </form>
                  </table>
                      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.
                      <meta http-equiv="Content-Type" content="text/html; charset=">
                      <title></title>
                      <script language="javascript">
function CheckAll(elementsA,elementsB)
{
    var len = elementsA;
    if(len.length > 0)
    {
        for(i=0;i<len.length;i++)
        {
            elementsA[i].checked = true;
        }
        if(elementsB.checked ==false)
        {
            for(j=0;j<len.length;j++)
            {
                elementsA[j].checked = false;
            }
        }
    }
    else
    {
        len.checked = true;
        if(elementsB.checked == false)
        {
            len.checked = false;
        }
    }
}
                </script>
                <td width="2" height="87">                </tr>
              </table></td>
            </tr>
<%
next
%>
  <tr>
    <td>
    &nbsp;
    <div align="center">
      <%if pageindex>1 then%>   
      <a href="<%=PageParameters&"&PageIndex=1"%>">首页</a>&nbsp;
      <%end if%>
        <%if pageindex>1 then%>
      <a href="<%=PageParameters&"&PageIndex="&pageindex-1%>">上页</a>&nbsp;
      <%end if%>
        <%if pageindex<rs2.pagecount then%>
      <a href="<%=PageParameters&"&PageIndex="&pageindex+1%>">下页</a>&nbsp;
      <%end if%>
        <%if pageindex<rs2.pagecount then%>
      <a href="<%=PageParameters&"&PageIndex="&rs2.pagecount%>">尾页</a>&nbsp;
      <%end if%>
  &nbsp;( 第 <%=pageindex%> 页 / 全 <%=rs2.pagecount%> 页 记录总数: <%=rs2.recordcount%> )&nbsp;
      
      
      <%if pageindex<7 then%>
      <%if pageindex<rs2.pagecount then%>
      <a href="<%=PageParameters&"&PageIndex=1"%>">1</a>&nbsp;
     <%end if%>
     
     <%if pageindex<rs2.pagecount then%>
      <a href="<%=PageParameters&"&PageIndex=2"%>">2</a>&nbsp;
      <%end if%>
      
      <%if pageindex<rs2.pagecount then%>
      <a href="<%=PageParameters&"&PageIndex=3"%>">3</a>&nbsp;
      <%end if%>
      <%if pageindex<rs2.pagecount then%>
      <a href="<%=PageParameters&"&PageIndex=4"%>">4</a>&nbsp;
    <%end if%>
    <%if pageindex<rs2.pagecount then%>
      <a href="<%=PageParameters&"&PageIndex=5"%>">5</a>&nbsp;
      <%end if%><%end if%>
      
      
      
      
      <%if pageindex>4 then%>
      <%if pageindex<12 then%>
      <a href="<%=PageParameters&"&PageIndex=6"%>">6</a>&nbsp;
      <a href="<%=PageParameters&"&PageIndex=7"%>">7</a>&nbsp;
      <a href="<%=PageParameters&"&PageIndex=8"%>">8</a>&nbsp;
      <a href="<%=PageParameters&"&PageIndex=9"%>">9</a>&nbsp;
      <a href="<%=PageParameters&"&PageIndex=10"%>">10</a>&nbsp;
      <%end if%>
      <%end if%>
      
      <%if pageindex>9 then%>
      <%if pageindex<15 then%>
      <a href="<%=PageParameters&"&PageIndex=11"%>">11</a>&nbsp;
      <a href="<%=PageParameters&"&PageIndex=12"%>">12</a>&nbsp;
      <a href="<%=PageParameters&"&PageIndex=13"%>">13</a>&nbsp;
      <a href="<%=PageParameters&"&PageIndex=14"%>">14</a>&nbsp;
      <a href="<%=PageParameters&"&PageIndex=15"%>">15</a>&nbsp;
      <%end if%>
      <%end if%>
      </div></td>
  </tr>
        </table>
    <% End If ' end Not Rs2.EOF Or NOT Rs2.BOF %></td>
  </tr>
</table>
<div align="center">
<% If Rs2.EOF And Rs2.BOF Then %>
<font color="red">没有找到您需要的记录</font>
    <% End If ' end Rs2.EOF And Rs2.BOF %>
</div>
</body>
</html>
<%
Rs1.Close()
Set Rs1 = Nothing
%>
<!--<%=Rs2.Source%>-->
<%
Rs2.Close()
Set Rs2 = Nothing
%>
<%
End If
%>

以下是删除代码
<%@CODEPAGE="936"%>
<!--#include file="Inc/Conndb.asp"-->
<!--#include file="Inc/Function.asp"-->
<!--#include file="Inc/Config.asp"-->
<%
dim ProductID,Action,sqlDel,rsDel,FoundErr,ErrMsg,ObjInstalled
ProductID=trim(Request("ProductID"))
Action=Trim(Request("Action"))
FoundErr=False
ObjInstalled=IsObjInstalled("Scripting.FileSystemObject")

if ProductID="" or Action<>"Del" then
    FoundErr=True
    ErrMsg=ErrMsg & "<br><li>参数不足!</li>"
end if
if FoundErr=False then
    if instr(ProductID,",")>0 then
        dim idarr,i
        idArr=split(ProductID)
        for i = 0 to ubound(idArr)
            call DelArticle(clng(idarr(i)))
        next
    else
        call DelArticle(clng(ProductID))
    end if
end if
if FoundErr=False then
    call CloseConn()
    Response.Redirect "ja_1.asp"
else
    call CloseConn()
    call WriteErrMsg()
end if

sub DelArticle(ID)
  dim PurviewChecked
    PurviewChecked=False
   
    sqlDel="SELECT * FROM ja_1 WHERE ID=" & CLng(ID)
   
     
    Set rsDel= Server.CreateObject("ADODB.RecordSet")
    rsDel.Open sqlDel,conn, 2,3
   
    if FoundErr=False then
        if conDelUpFiles="Yes" and ObjInstalled=True then
            dim fso,strUploadFiles,arrUploadFiles
            if strUploadFiles<>"" then
                Set fso = CreateObject("Scripting.FileSystemObject")
                if instr(strUploadFiles,"|")>1 then
                    arrUploadFiles=split(strUploadFiles,"|")
                    for i=0 to ubound(arrUploadFiles)
                        if fso.FileExists(Server.MapPath("../" & arrUploadfiles(i))) then
                            fso.DeleteFile(Server.MapPath("../" & arrUploadfiles(i)))
                        end if
                        
                        
                    next
                else
               
                    if fso.FileExists(Server.MapPath("../" & strUploadfiles)) then
                        fso.DeleteFile(Server.MapPath("../" & strUploadfiles))
                    end if
                end if
                Set fso = nothing
            end if
        end if
        rsDel.DELETE
        rsDel.UPDATE
        set rsDel=nothing
        'conn.Execute "DELETE FROM Comment WHERE ProductID=" & CLng(ID)
    end if
end sub
%>


 
 
 
 
 
 
搜索更多相关主题的帖子: 单表 删除 查询 
2010-10-24 19:53
gupiao175
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:40
帖 子:1787
专家分:7527
注 册:2007-6-27
收藏
得分:3 
内容这么多,看得头都晕了!顶!期待高手给你解决方法!

我这里不知道是不是系统出问题了,折腾半天没有搞好IIS,明天找人重做一个完整系统!

Q:1428196631,百度:开发地 即可找到我,有事请留言!
2010-10-25 15:17
yangfeng_8
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2010-10-24
收藏
得分:0 
在线等,请朋友帮我解答这问题
2010-10-25 16:00
yangfeng_8
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2010-10-24
收藏
得分:0 
不会吧,重装一下一般都能搞定
2010-10-25 16:47
dzt0001
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:蒙面侠
威 望:5
帖 子:1281
专家分:4998
注 册:2005-10-12
收藏
得分:3 
代码太长了,没仔细看。
一般就是写几个删除的SQL语句,逐个执行

----我怎能在别人的苦难面前转过脸去----
2010-10-25 16:57
yangfeng_8
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2010-10-24
收藏
得分:0 
可是我试了好多方法就是不行,不能把它放在里面实现,烦啊。
2010-10-25 17:22
yangfeng_8
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2010-10-24
收藏
得分:0 
主要是这里
    '组织SQL语句
    strSQL="SELECT * FROM  ja_1 "
   
   
   
   
    strSQL = strSQL & " WHERE ja_1.id  = ja_1.id"
   
   
   
   
    if szTitle<>"" then        '如果药品名称过滤条件不为空
        strSQL=strSQL & " and [Name] like '%" & szTitle & "%' "
    end if
    if IsNumeric(nTypeId) then        '如果药品类型编号正确
        strSQL=strSQL & " and Product.TypeId=" & nTypeId
    else
2010-10-25 17:23
yangfeng_8
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2010-10-24
收藏
得分:0 
还有这里,不懂怎么才能实现多表连接,指向删除sub DelArticle(ID)
  dim PurviewChecked
    PurviewChecked=False
   
    sqlDel="SELECT * FROM ja_1 WHERE ID=" & CLng(ID)
   
     
    Set rsDel= Server.CreateObject("ADODB.RecordSet")
    rsDel.Open sqlDel,conn, 2,3
   
    if FoundErr=False then
        if conDelUpFiles="Yes" and ObjInstalled=True then
            dim fso,strUploadFiles,arrUploadFiles
            if strUploadFiles<>"" then
                Set fso = CreateObject("Scripting.FileSystemObject")
                if instr(strUploadFiles,"|")>1 then
                    arrUploadFiles=split(strUploadFiles,"|")
                    for i=0 to ubound(arrUploadFiles)
                        if fso.FileExists(Server.MapPath("../" & arrUploadfiles(i))) then
                            fso.DeleteFile(Server.MapPath("../" & arrUploadfiles(i)))
                        end if
2010-10-25 17:24
yangfeng_8
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2010-10-24
收藏
得分:0 
这程序能实现 全选一个数据表 后删除,也可以实现一个个文件删除,可多个表能实现全选,但不能删除,也不能删除表B内容,只能删除表A的,还有,程序能实现查询多个表的内容,但不能删除多个表的内容,请版主帮帮忙吧,我用了好多方法都没搞定
2010-10-25 17:30
dzt0001
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:蒙面侠
威 望:5
帖 子:1281
专家分:4998
注 册:2005-10-12
收藏
得分:0 
我看删除部分的代码,是先删除附件,再删除文章,最后删除评论,不知道你是哪里出了问题,报什么错?

----我怎能在别人的苦难面前转过脸去----
2010-10-25 17:32
快速回复:程序能实现单表删除,多表查询,要怎么实现多表删除
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.027721 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved