调试中遇到问题,在线的进来看下,急,在线等!

rob123 2005-10-14 11:23:40
调试过程中老是提示语句未结束,提示的行是这句:

rs.open "select * from [user_class] where classroom='"&bclass&"' and datepart("Dy",begintime)='"&mday&"' and datepart("Hh",begintime)='"&bhour&"'",conn,1,3

---------------------------------------------------------------------------------------------------

大家帮忙看看是怎么回事,急!!!!先谢谢了!知道的可以加我QQ4705648

整页源码为:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="check.asp"-->
<%
bhour=9
bclass=1
nday=datepart("ww",now())
sweek=trim(request("sweek"))
sday=trim(request("sday"))
if sweek<>"" and sday<>"" then
xday=sday-nday
if sweek=2 then
xday=xday+7
end if
stime=dateadd("d",xday,now())
else
stime=now()
end if
mday=datepart("y",stime)
'rs.open "select * from [user_class]",conn,1,3
%>
<style type="text/css">
<!--
.style1 {color: #FFFFFF}
-->
</style>

<hr noshade size="1">
<table width="780" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="right" bgcolor="#CCCCCC">您现在查看的是:asp的课程</td>
<td align="right" bgcolor="#CCCCCC">打印当前课表</td>
<td align="right" bgcolor="#CCCCCC"><form action="class_list1.asp" method="post" name="search" id="search">
选择课程查询 
<select name="sweek" id="sweek">
<option value="1" selected>本周课程</option>
<option value="2">下周课程</option>
</select>
   
<select name="sday" id="sday">
<option value="1">周日</option>
<option value="2">周一</option>
<option value="3">周二</option>
<option value="4">周三</option>
<option value="5">周四</option>
<option value="6">周五</option>
<option value="7">周六</option>
</select>
   
<input type="submit" name="Submit" value="查看">
</form></td>
</tr>
</table>
<table width="780" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#000000">
<tr bgcolor="#008306">
<td align="center" bgcolor="#008306"><span class="style1">Time\ClassRoom</span></td>
<td height="20" align="center" bgcolor="#008306"><span class="style1">ClassRoom1</span></td>
<td align="center" bgcolor="#008306"><span class="style1">ClassRoom2</span></td>
<td align="center" bgcolor="#008306"><span class="style1">ClassRoom3</span></td>
<td align="center" bgcolor="#008306"><span class="style1">ClassRoom4</span></td>
<td align="center" bgcolor="#008306"><span class="style1">ClassRoom5</span></td>
</tr>
<%do while bhour<21%>
<tr bgcolor="#FFFFFF">

<td height="30" align="center" bgcolor="#008306"><span class="style1"><%=bhour%>:00-<%=(bhour+1)%>:00</span></td>
<%
set rs=server.createobject("adodb.recordset")
do while bclass<6
rs.open "select * from [user_class] where classroom='"&bclass&"' and datepart("Dy",begintime)='"&mday&"' and datepart("Hh",begintime)='"&bhour&"'",conn,1,3
%>
<td align="center" bgcolor="#C9E393"><%if rs.bof and rs.eof then%>添加课程<%else%><%=rs("classname")%> <%=rs("seatb")%>/<%=rs("seatt")%><br><%=rs("teacher")%><%end if%></td>
<%
rs.close
bclass=bclass+1
loop
%>


</tr>
<%
bhour=bhour+1
loop
%>
</table>
<p> </p>

...全文
118 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
intereye 2005-10-15
  • 打赏
  • 举报
回复
把datepart("Dy",begintime)其中的的双引号变成单引号试试~~~
rob123 2005-10-15
  • 打赏
  • 举报
回复
问题得到解决了.而且把循环改成for方式后显示也正常了。只是性能明显下降了很多,有没有什么办法?
wanghui0380 2005-10-15
  • 打赏
  • 举报
回复
rs.open "select * from [user_class] where classroom='"&bclass&"' and datepart(""Dy"",begintime)='"&mday&"' and datepart(""Hh"",begintime)='"&bhour&"'",conn,1,3

双引号的问题:
vbs字符串中""才被转义成",而"号则被定义成字符串起止标记

rob123 2005-10-15
  • 打赏
  • 举报
回复
现在变成
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]为 datepart 指定了无效的参数 1。
还是这行.

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧