| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 598 人关注过本帖
标题:ASP循环取值怎么做
只看楼主 加入收藏
Caricyn
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2013-10-28
结帖率:0
收藏
已结贴  问题点数:20 回复次数:1 
ASP循环取值怎么做
这是传值页面
<%@Language="vbscript" Codepage="65001"%><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
</head>
 
<STYLE type="text/css">
<!--
body {
    margin-left: 0px;
    margin-top: 0px;
    text-align: center;
}
.TL {
    font-size: 14px;
    border: 1px solid #000;
    font-weight: bold;
}
.title {
    font-size: 20px;
}
.nr {
    font-size: 12px;
    text-align: center;
}
.sr {
    height: 30px;
    width: 40px;

}
-->
</STYLE>
<%
dim ConnStr,Conn,rs,i,id
id=trim(request("name"))
ConnStr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath("s1.mdb")
On Error Resume Next
Set conn = Server.CreateObject("ADODB.Connection")
Conn.Open ConnStr
If Err Then
Err.Clear
Set Conn = Nothing
response.write "数据库连接失败..."
Response.End()
End If
Sql="select * from s1 where name='"&id&"'"
response.write(id)
Set Rs = Server.CreateObject("Adodb.RecordSet")
Rs.Open Sql,Conn,1,1
if RS.eof then
response.write "还没有数据"
else
%>

<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
  <TBODY>
  <TR>
    <TD align="center">
      <TABLE width="800" border="0" cellspacing="0" cellpadding="0">
        <TBODY>
        <TR>
          <TD>
            <TABLE width="500" border="0" cellspacing="0" cellpadding="0">
              <TBODY>
              <TR class="title">
                <TD width="400" height="50"
                align="center">2013年重庆市桥梁定期检查进度统计情况</TD>
                <TD width="100" align="center"><%=rs("name")%></TD></TR></TBODY></TABLE></TD></TR>
        <TR>
          <TD>
            <TABLE width="100%" class="TL" border="0" cellspacing="0"
            cellpadding="0">
              <TBODY>
              <TR>
                <TD width="17%" height="59" align="center" class="TL">国省县道<BR>
                               桥梁总数量</TD>
                <TD width="15%" align="center" class="TL">
                  <P>2013年安排定<BR>              检桥梁总数量</P></TD>
                <TD width="16%" align="center" class="TL">其中国省县道<BR>           
                     定检桥梁数量</TD>
                <TD width="27%" align="center" class="TL">国省县道特大桥、特殊结构<BR>     
                           和特别重要桥梁数量</TD>
                <TD width="25%" align="center" class="TL">2013年定检国省县道桥梁数<BR>   
                             占国省县道总桥梁数的比例</TD></TR>
              <TR>
                <TD height="36" align="center" class="TL"><%=rs("a")%></TD>
                <TD align="center" class="TL"><%=rs("b")%></TD>
                <TD align="center" class="TL"><%=rs("c")%></TD>
                <TD align="center" class="TL"><%=rs("d")%></TD>
                <TD align="center" class="TL"><%=round(rs("c")/rs("a")*100,0)%>%</TD></TR></TBODY></TABLE></TD></TR>
        <TR>
          <TD>&nbsp;</TD></TR>
        <TR>
          <TD>
<form method="post" action="update.asp?id=<%=rs("name")%>">
          <%
rs.close
conn.close
set rs=nothing
set conn=nothing
end if
%>

            <TABLE width="100%" class="nr" border="1" cellspacing="0"
            cellpadding="0">
              <TBODY>
              <TR>
                <TD align="center" class="nr">期数</TD>
                <TD align="center" class="nr">已委托检<BR>              测单位座数</TD>
                <TD align="center" class="nr">未委托检<BR>              测单位座数</TD>
                <TD align="center" class="nr">是否正在<BR>              开展外业<BR>   
                             工作</TD>
                <TD align="center" class="nr">已完成外<BR>              业座数</TD>
                <TD align="center" class="nr">已完成内<BR>              业座数</TD>
                <TD align="center" class="nr">已完成<BR>              报告审<BR>     
                           查座数</TD>
                <TD align="center" class="nr">已报市公<BR>              路局备案<BR>   
                                           数</TD>
                <TD align="center" class="nr">已将报告录入<BR>“桥梁动态分析系统”<BR>座数</TD>
                <TD align="center" class="nr">备注</TD></TR>
<%
dim ConnStr1,Conn1,rs1,i1
ConnStr1 = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath("s1.mdb")
On Error Resume Next
Set conn1 = Server.CreateObject("ADODB.Connection")
Conn1.Open ConnStr1
If Err Then
Err.Clear
Set Conn1 = Nothing
response.write "数据库连接失败..."
Response.End()
End If
Sql1="select * from s2 where name='合川区'"
Set Rs1 = Server.CreateObject("Adodb.RecordSet")
Rs1.Open Sql1,Conn1,1,1
if RS1.eof and RS1.bof then
response.write "还没有数据"
else
  do until rs1.eof
%>

              <TR>
                <TD height="50"><%=rs1("qs")%></TD>
                <TD><LABEL><INPUT name="a1" class="sr" type="text" value="<%=rs1("a1")%>">
                              </LABEL></TD>
                <TD><INPUT name="a2" class="sr" type="text" value=""></TD>
                <TD><select name="Type" id="kejiandu">
      <option value="1" <%If rs1("a3")="1" Then response.write " Selected"%>>是</option>
      <option value="0" <%If rs1("a3")="0" Then response.write " Selected"%>>否</option>
 </select>
                  </TD>
                <TD><INPUT name="a4" class="sr" type="text" value="<%=rs1("a4")%>"></TD>
                <TD><INPUT name="a5" class="sr" type="text" value="<%=rs1("a5")%>"></TD>
                <TD><INPUT name="a6" class="sr" type="text" value="<%=rs1("a6")%>"></TD>
                <TD><INPUT name="a7" class="sr" type="text" value="<%=rs1("a7")%>"></TD>
                <TD><INPUT name="a8" class="sr" type="text" value="<%=rs1("a8")%>"></TD>
                <TD><INPUT name="a9" class="sr" type="text" value="<%=rs1("a9")%>"></TD></TR>
  <% rs1.movenext
  loop
  %>

              </TBODY></TABLE>
              <br />
              <input name="" type="submit" value="保存" />
          </FORM></TD></TR>
       </TBODY></TABLE></TD></TR></TBODY></TABLE>
         

  <%
  rs1.close
conn1.close
set rs1=nothing
set conn1=nothing
end if
%>


这是接收页面
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>
<%
dim ConnStr,Conn,rs,i,id
id=request("id")
a1=request("a1")
a3=request("a3")
a4=request("a4")
a5=request("a5")
a6=request("a6")
a7=request("a7")
a8=request("a8")
a9=request("a9")
ConnStr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath("s1.mdb")
On Error Resume Next
Set conn = Server.CreateObject("ADODB.Connection")
Conn.Open ConnStr
If Err Then
Err.Clear
Set Conn = Nothing
response.write "数据库连接失败..."
Response.End()
End If

Set rs = Server.CreateObject("ADODB.Recordset")
sql = "select a1,a3,a4,a5,a6,a7,a8,a9 from s2 where name ='id'"

    Rs.Open Sql,Conn,1,3
    do while not rs.eof     
rs("a1")=a1
rs("a3")=a3
rs("a4")=a4
rs("a5")=a5
rs("a6")=a6
rs("a7")=a7
rs("a8")=a8
rs("a9")=a9
    rs.update
    rs.movenext   
    loop
    rs.close
Set Rs=Nothing
response.write (a1)
   %>
</body>
</html>


如果传值页面a1有9个值  接收页面a1取到的是1,1,1,1,1,1,1,1,1  无法更新 求帮助
搜索更多相关主题的帖子: content border center title 
2013-10-28 14:37
ywyql_84
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:54
专家分:180
注 册:2011-4-4
收藏
得分:20 
把 On Error Resume Next 去掉 看错误提示是什么
2013-10-28 19:45
快速回复:ASP循环取值怎么做
数据加载中...
 
   



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

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