回 帖 发 新 帖 刷新版面

主题:请问数据库调用有问题么谢谢

<script language=javascript>
function checkAll(e, itemName) {
    aa = document.getElementsByName(itemName);
    for (i = 0; i < aa.length; i++) {
        aa[i].checked = e.checked;
    }
}
function checkItem(e, allName) {
    all = document.getElementsByName(allName)[0];
    if (!e.checked) {
                           all.checked = false;
    } else {
        aa = document.getElementsByName(e.name);
        for (i = 0; i < aa.length; i++) {
            if (!aa[i].checked) {
                return;
            }
        }
        all.checked = true;
    }
}

</script>

</head>

<body>
<form id="form1" name="myform" method="post" action="information_list1.asp">

  <table width="558" border="1">
    <tr>
      <th width="36" scope="col"> </th>
       <th width="156" scope="col">名称</th>
        <th width="81" scope="col">年龄</th>
         <th width="105" scope="col">性别</th>
          <th width="89" scope="col">父亲</th>
           <th width="51" scope="col">母亲</th>
    </tr>
<%     从数据库中获得元素

Set Conn=Server.CreateObject("ADODB.Connection")
    Conn.Connectionstring="DRIVER={SQL Server};Server=127.0.0.1;Database=information;Trusted_Connection=no;UID=sa;PWD=fdsa;"
   sql="select    a.info_sex,a.info_name,a.info_year,b.info_name,c.info_name from information a,information b,information c "&_
"where a.info_mother = b.info_id and a.info_father = c.info_id "   
    Response.Write sql
    Conn.Execute(sql)
    message = "保存成功"
    Set rs=Server.CreateObject("ADODB.Recordset")
    Set rs.ActiveConnection=Conn
    s.CursorType=1
    rs.OPEN "Select *from information Order by info_id "
    rCount=rs.RecordCount
Do While Not rs.EOF
%>    
 <tr>
        <td>
            <INPUT type="checkbox" value="<%=rs("a.info_name")%>" name="info_id" onclick="checkItem(this, 'roleAll')">
        </td>
          <td><a  href="information_index_update1.asp?info_id=<%=rs("a.info_name")%>"><%=rs("a.info_name")%></a></td>
           <td><%=rs("a.info_name")%></td>
            <td><%=rs("a.info_name")%></td>
             <td><%=rs("a.info_name")%></td>
               <td><%=rs("a.info_name")%></td>
</tr>

 <%
          rs.movenext
          loop
 %>     
 
      
<tr>
   <td height="28" colspan="2"> 
     <label>
             <input type="button" value="全选" ><input type="checkbox" name="roleAll"
             onclick="checkAll(this, 'info_id')"  >
            
     <td>
        <label>      </label>
    </td> 
        

           <input type="submit"  value="删除"onclick="information_del.asp">
        </label>        
    </td>
    <td > </td>
    <td>
          <label><INPUT type="submit" value="修改" onclick="information_index_update1.asp">
                
          </label> 
    </td>
    
</tr>
</table>
</body>
</html>
出错提示是
Microsoft VBScript 编译器错误 错误 '800a03f6' 

缺少 'End' 

/iisHelp/common/500-100.asp,行242 

Microsoft VBScript 编译器错误 错误 '800a0408' 

无效字符 

/home/new information/sixscript/information_list1.asp,行44 

从数据库中获得元素

回复列表 (共2个回复)

沙发

<%=rs("a.info_name")%> ==>  <%=rs("info_name")%>

这里不需要表前缀

板凳

直接将名称添加到付值的括号里就可以了!

我来回复

您尚未登录,请登录后再回复。点此登录或注册