asp中数据查询

来源:百度知道 编辑:UC知道 时间:2024/05/10 19:49:33
数据库中link.mdb 中有表zbb 属性有:id who xingqi kecheng
<%
dim db,rs,strsql
Set db=Server.CreateObject("ADODB.Connection")
connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("link.mdb")
db.open connstr
strsql="select * from zbb where xingqi=weekday(date) and kecheng=k order by zbb_id desc "
set rs=db.execute(strsql)
%>
<% do while not rs.eof %>
<% Response.Write"<p><input type='checkbox' name='rs('who')' value='rs('who')'>董祁恩</p>"
rs.movenext
loop
%>
想实现根据星期weekday(date)和课程k
动态显示签到表单中的checkbox
但是总是调试报错:
错误类型:
Microsoft JET Database Engine (0x80040E10)
至少一个参数没有被指定值。
/qiandao/qiandaobiao.asp, 第 79 行
本人ASP菜鸟希望指点
第79行有错误
79行是:
set rs=db.execute(strsql)
那这一句:
str

strsql="select * from zbb where xingqi=weekday(date) and kecheng=k order by zbb_id desc "
估计错在kecheng=k上。
你的数据库中有K这个字段吗?
如果K是ASP中的变量
请这样写:
k是数字:
strsql="select * from zbb where xingqi=weekday(date) and kecheng="&k&" order by zbb_id desc "
k是字符串:
strsql="select * from zbb where xingqi=weekday(date) and kecheng='"&k&"' order by zbb_id desc "

第79行有错误 没有原文件看不清楚估计你数据库中的值有空值