| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 679 人关注过本帖
标题:查询不出数据库中的内容
只看楼主 加入收藏
leileiguo
Rank: 1
等 级:新手上路
帖 子:13
专家分:0
注 册:2006-3-5
收藏
 问题点数:0 回复次数:1 
查询不出数据库中的内容
<!--#include file="conn.asp"-->
<!--#include file="../inc/format.asp"-->
<head>
<meta name="keywords" content= "算法与设计教学网站">
<meta name="description" content= "算法与设计教学网站">
<title>算法与设计教学网站</title>
<LINK href="image/css.css" type=text/css rel=stylesheet>
<SCRIPT LANGUAGE="VBSCRIPT">
    <!--
    SETTIMEOUT "CLOCK",1000
    SUB CLOCK()
    H=HOUR(NOW)
    M=MINUTE(NOW)
    S=SECOND(NOW)
    NOWTIME="现在时间是"&H&"点"&M&"分"&S&"秒"
    NOWT.INNERHTML=NOWTIME
    SETTIMEOUT "CLOCK",1000
    END SUB
      -->
    </SCRIPT>
</head>
<SCRIPT language=javascript>
function check()
{   
    var strChapter=document.form1.YourChapter.value;
        if (strChapter=="")
    {
        alert("请选择章节!");
        return false;
      }
</SCRIPT>
</head>
<%
kc_name=request("kc_name")
chapter_num=request("chapter_num")

sql="select * from ktxx_kj where kc_name=kc_name"
rs.open sql,conn,1,1

%>

<body bgcolor="#CCCCCC" background="image/bg_2.gif" style="background-image: url('image/bg2.gif')">
<div align=center>
<table border="0"  width="820" id="table1" cellpadding=0 cellspacing=0 height="621">
<tr>
        <td width=25 background="image/LEFT_BG.gif"> </td>
        <td bgcolor="#FFFFFF">
    
   <table width="770" height="173" border="0" cellpadding="0" cellspacing="0" >
     <TR>
 
        <TD vAlign=top width=770 height=173><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.,0,29,0" width="770" height="173">
      <param name="movie" value="121.swf">
      <param name="quality" value="high">
      <embed src="121.swf" quality="high" pluginspage="http://www. type="application/x-shockwave-flash" width="770" height="173"></embed>
    </object></TD>
  </TR>
</table>    

<div align="center">
    
<table width="770" height="735" border="0" cellpadding="0" cellspacing="0">
  
  <tr >
   
    </tr>
  <tr >
    <td width="25%" height="573" bgcolor="#FFFFFF" style="background-image: url('image/xu.gif'); background-repeat: repeat-y; background-position: right top" valign=top><form action="ShowShijuan22.asp?kc_name=<%=request("kc_name")%>" method="post" name=form1  onsubmit="javaScript:return check();">
  <div align="center">
  <table width="770" border="0" cellspacing="1" cellpadding="5"bgcolor="#C0C0C0">
    <tr >
    <td width="25%" height="10" bgcolor="#FFFFFF" background="image/xx11.gif"><CENTER ID="NOWT"></  CENTER></td>
    <td height="10" bgcolor="#FFFFFF" background="image/xx11.gif"><div align="center"> <b> <font color="#000000">在线测试系统</font></b></div>
      <td height="20" colspan="3" bgcolor="#FFFFFF" background="image/xx11.gif"><a href="../index.asp">返回首页</a></td>
    </tr>
    <tr >
      <td width=30% bgcolor="#FFFFFF"><font color="#009900">章节选择:</font></td>
      <td bgcolor="#FFFFFF" width="35%"><font color="#009900">题 型</font></td>
      <td bgcolor="#FFFFFF" width="35%"><font color="#009900">难 度</font></td>
    </tr>
    <tr>
      <td bgcolor="#FFFFFF" rowspan="4">
      <table align=center cellpadding=0 cellspacing=1>
      <% for i=1 to Chapter_Num %>
      <tr><td bgcolor=#ffffff>
      <input type=CheckBox  name=YourChapter value="<%=i%>"></td><td><%=i%></td><td><%=kj_name%></td></tr>
      <% Next %>
      </table>
      </td>
      <td bgcolor="#FFFFFF">选 择</td>
      <td bgcolor="#FFFFFF"> <select name="xuanze">
          <option>1</option>
          <option>2</option>
        </select></td>
    </tr>
    <tr>
      <td bgcolor="#FFFFFF">填 空</td>
      <td bgcolor="#FFFFFF"> <select name="tiankong">
          <option>1</option>
          <option>2</option>
        </select> </td>
    </tr>
    <tr>
      <td bgcolor="#FFFFFF">问 答</td>
      <td bgcolor="#FFFFFF"> <select name="wenda">
          <option>1</option>
          <option>2</option>
        </select> </td>
    </tr>
    <tr>
      <td colspan="2" bgcolor="#FFFFFF"> <input type="submit" value="随机抽题"> </td>
    </tr>
   
  </table>
    </div>
</form>
&nbsp;</td>
  </tr>
  <tr bgcolor="#5bbd2b" >
    <td bgcolor="#FFFFFF">
     </td>
  </tr>
  <tr bgcolor="#5bbd2b" >
    <td bgcolor="#FFFFFF">
    <img border="0" src="../image/123.gif" width="769" height="48"></td>
  </tr>
  </table>
<table width="100%" height="20"  border="0" cellpadding="0" cellspacing="0">
       <tr>
         <td width="4%" height="20"><img src="image/but05_left.gif" width="38" height="37"></td>
         <td width="92%" background="image/but05_bg.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            Copyright &copy; 2006:南昌工程学院计算机科学与技术系&nbsp;&nbsp;&nbsp; author:刘东晓,邓少波,黎敏</td>
         <td width="4%"><img src="image/but05_right.gif" width="39" height="37"></td>
       </tr>
     </table>
</div>

</td>
    <td width=25 background="image/RIGHT_BG.gif"> </td>
    </tr>
</table>
</div>
</body>




这是源代码,请问哪里出了问题
搜索更多相关主题的帖子: 查询 数据库 
2008-11-15 15:21
leileiguo
Rank: 1
等 级:新手上路
帖 子:13
专家分:0
注 册:2006-3-5
收藏
得分:0 
弄错了,是下面的代码
<!--#include file="conn.asp"-->
<!--#include file="../inc/format.asp"--><head>
<meta name="keywords" content= "算法与设计教学网站">
<meta name="description" content= "算法与设计教学网站">
<title>算法与设计教学网站</title>
<LINK href="image/css.css" type=text/css rel=stylesheet>
<LINK
href="../image/css.css" type=text/css rel=stylesheet>
<Script language="Vbscript">
<!--
 i=0
 SetTimeOut "Clock",1000
 Sub Clock()
   i=i+1
 NowT.InnerHtml=i
 H=HOUR(NOW)
    M=MINUTE(NOW)
    S=SECOND(NOW)
    NOWTIME="现在时间是"&H&"点"&M&"分"&S&"秒"
    NOWT2.INNERHTML=NOWTIME
 SetTimeOut "Clock",1000
 End Sub
-->

</script>
</head>

<style type="text/css">
<!--
body {
    margin-top: 0px;

}
-->
</style>
<%
kc_name=request("kc_name")

xuanze=request("xuanze")
tiankong=request("tiankong")
wenda=request("wenda")
MyString=request("YourChapter")
If MyString="" Then
 Response.Write "<script language=javascript>"
 Response.Write "alert('请选择章节!');"
   Response.write ("history.go(-1)")
Response.Write "</script>"

End If
YourChapter=Split(MyString,",")
For i=0 To Ubound(YourChapter)
  YourChapter(i)=Trim(YourChapter(i))
Next
%>
<body>
<body bgcolor="#CCCCCC" background="image/bg_2.gif" style="background-image: url('image/bg2.gif')">
<div align=center>
<table border="0"  width="820" id="table1" cellpadding=0 cellspacing=0 height="621">
<tr>
        <td width=25 background="image/LEFT_BG.gif"> </td>
        <td bgcolor="#FFFFFF">
    
   <table width="770" height="173" border="0" cellpadding="0" cellspacing="0" >
     <TR>
 
        <TD vAlign=top width=770 height=173><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.,0,29,0" width="770" height="173">
      <param name="movie" value="121.swf">
      <param name="quality" value="high">
      <embed src="121.swf" quality="high" pluginspage="http://www. type="application/x-shockwave-flash" width="770" height="173"></embed>
    </object></TD>
  </TR>
</table>    
<table width="770" height="10" border="0" cellpadding="0" cellspacing="0">
  
  <tr >
    <td width="191" height="10" bgcolor="#FFFFFF" background="image/xx11.gif"><center ID="NOWT2"></center></td>
    </tr></table>
<div align="center">
    
<table width="770" height="735" border="0" cellpadding="0" cellspacing="0">
  
  <tr >    </tr>
  <tr >
    <td width="25%" height="573" bgcolor="#FFFFFF" style="background-image: url('image/xu.gif'); background-repeat: repeat-y; background-position: right top" valign=top>
<form name="Shijuan" action="Result.asp" method="post">
 <INPUT type=hidden name=Time value="<% = Now %>">
<div align="center">
  <table cellspacing="0" width="760" bgcolor="#FFFFFF">
    <tr>
    <td bgcolor="#FFFFFF" background="../image/show.gif">
      <%
SQL="select * From Test_xuanze "
For i=0 to Ubound(YourChapter)
 If YourChapter(i)<>"" Then
    If InStr(SQL,"Where")=0 Then
       SQL=SQL&"Where kc_name='"&kc_name&"' and difficulty='"&xuanze&"' and Chapter='"&YourChapter(i)&"'"
    else
       SQL=SQL&"or kc_name='"&kc_name&"' and difficulty='"&xuanze&"' and Chapter='"&YourChapter(i)&"'"
    End If
 End If
Next
set Rs=server.CreateObject("Adodb.recordset")
rs.open SQL,conn,3
%>
<%
AllCount=Rs.RecordCount
AllCount2=Allcount-5
If AllCount2<1 Then
Response.Write "<script language=javascript>"
 Response.Write "alert('没有符合条件的记录!');"
   Response.write "history.go(-1)"
Response.Write "</script>"
response.end
End If
%>
<%
 Randomize
 RndCount=Int(Rnd()*(Allcount2-1+1))+1
 Rs.AbsolutePosition=RndCount
%>
        <div align="center">
<table width=760 cellpadding=3 cellspacing=1>
  <tr><td bgcolor=#ffffff>
 <table><tr><td>
 <font color="#000000">您已经用时:<span id="NowT" ></span>秒!</font></td></tr>
<tr><td colspan=2>
<font color="#FF6600">一 选择:</font></td></tr>
<%
Dim b(5)
%>
<% For i=0 to 4%>
  <tr>
    <td> <%=i+1%>&nbsp;&nbsp;<%=Rs("Question")%></td>
    <td></td>
</tr>
  <tr >
    <td>A.<%=Rs("Option1")%></td>
    <td>B.<%=Rs("Option2")%></td></tr>
  <tr >
    <td>C.<%=Rs("Option3")%></td>
    <td>D.<%=Rs("Option4")%></td></tr>
  <tr>
    <td>
        <p>
        <%
          for m= 1 to 4  
        %>  
                <INPUT type="radio" name=Radio<%=i%> value=<% =m %>>
<%
 If m=1 Then
  Response.Write "A"
 End If
 If m=2 Then
  Response.Write "B"
 End If
 If m=3 Then
  Response.Write "C"
 End If
 If m=4 Then
  Response.Write "D"
 End If
%>
                <input type="hidden" name="Answer"  value=<%=Rs("Answer")%>>
        <% Next %>    
        </p>
      </td>
  </tr>
<%
b(i)=Rs("Answer")
%>
<input type="hidden" name=bb<%=i%> value=<%=b(i)%>>
<%
Rs.MoveNext
Next
%>
</table>


<%
SQL="select * From Test_tiankong "
For i=0 to Ubound(YourChapter)
 If YourChapter(i)<>"" Then
     If InStr(SQL,"Where")=0 Then
       SQL=SQL&"Where kc_name='"&kc_name&"' and difficulty='"&tiankong&"' and Chapter='"&YourChapter(i)&"'"
    else
       SQL=SQL&"or kc_name='"&kc_name&"' and difficulty='"&tiankong&"' and Chapter='"&YourChapter(i)&"'"
    End If
 End If
Next
set Rs=server.CreateObject("Adodb.recordset")
rs.open SQL,conn,3
%>
<%
AllCount=Rs.RecordCount
AllCount2=Allcount-5
If AllCount2<1 Then
Response.Write "没有满足条件的记录!"
Response.End
End If
%>
<%
 Randomize
 RndCount=Int(Rnd()*(Allcount2-1+1))+1
 Rs.AbsolutePosition=RndCount
%>
<table>
<tr><td colspan=2>
<font color="#FF6600">二 填空</font></td></tr>
<% For i=0 to 4%>
  <tr>
    <td> <%=i+1%>&nbsp;&nbsp;<%=Rs("Question")%></td>
    <td></td>
</tr>
  <tr>
    <td>
        <p>
                <INPUT type="text" name="YourAnswer<%=i%>" style="border: 1px dotted #000000" size="20">
                <input type="hidden" name=Tiankong<%=i%>  value=<%=Rs("Answer")%>>
        </p>
      </td>
  </tr>
<%
Rs.MoveNext
Next
%>
</table>

</td></tr>
</table>
        </div>
    </td>
</tr>
<tr bgcolor="#999999" height=50><td bgcolor="#FFFFFF" height="30">
    <p align="center"><input type="submit" name="BtnSubmit" value="提交试卷"></td></tr>
</table>
</div>
</form>
&nbsp;</td>
  </tr>
  <tr bgcolor="#5bbd2b" >
    <td bgcolor="#FFFFFF">
     </td>
  </tr>
  <tr bgcolor="#5bbd2b" >
    <td bgcolor="#FFFFFF">
    <img border="0" src="../image/123.gif" width="770" height="48"></td>
  </tr>
  </table>
</div>
<!--#include file="../inc/blog1.asp"-->
</div>
</body>

</html>
2008-11-15 15:32
快速回复:查询不出数据库中的内容
数据加载中...
 
   



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

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