| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 823 人关注过本帖
标题:请教关于SQL的问题
取消只看楼主 加入收藏
intelwyf
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2005-5-22
收藏
 问题点数:0 回复次数:1 
请教关于SQL的问题
我的OA系统(用SQL数据库),点查询后,不能正常运行提示:
--------------------------------------------------------------------------------

技术信息(用于支持人员)

错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]第 1 行: '#' 附近有语法错误。
/havercidate.asp, 第 102 行


浏览器类型:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)

网页:
POST 42 ??? /havercidate.asp

POST Data:
myyear=2005&mymonth=5&myday=20&lookfor=yes

时间:
2005年5月22日, 10:00:08


havercidate.asp的原文件,谢谢
<!--#include file="asp/sqlstr.asp"-->
<!--#include file="asp/bgsub.asp"-->
<!--#include file="asp/opendb.asp"-->
<!--#include file="asp/checked.asp"-->
<%
oabusyname=request.cookies("oabusyname")
oabusyusername=request.cookies("oabusyusername")
oabusyuserdept=request.cookies("oabusyuserdept")
oabusyuserlevel=request.cookies("oabusyuserlevel")
if oabusyusername="" then
response.write("<script language=""javascript"">")
response.write("window.top.location.href='default.asp';")
response.write("</script>")
response.end
end if


'取得当前日
myday=day(now())
if request("myday")<>"" then myday=cint(request("myday"))
'取得当前月
mymonth=month(now())
if request("mymonth")<>"" then mymonth=cint(request("mymonth"))
'取得当前年
myyear=year(now())
if request("myyear")<>"" then myyear=cint(request("myyear"))
%>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<link rel="stylesheet" href="css/css.css">
<title>Crackgo办公系统</title>
</head>
<body bgcolor="#eeeeee" topmargin="5" leftmargin="5">
<% call bghead() %>
<center>
<table>
<tr>
<form method=post action="havercidate.asp">
<td><input type="submit" name="submit" value="全部"></td>
</form>
<form method=post action="havercidate.asp">
<td>
<select name="myyear" size=1>
<%
for i=2001 to 2010
%>
<option value=<%=i%><%=selected(i,myyear)%>><%=i%>年</option>
<%
next
%>
</select>
<select name="mymonth" size=1>
<%
for i=1 to 12
%>
<option value=<%=i%><%=selected(i,mymonth)%>><%=i%>月</option>
<%
next
%>
</select>
<select name="myday" size=1>
<%
for i=1 to 31
%>
<option value=<%=i%><%=selected(i,myday)%>><%=i%>日</option>
<%
next
%>
</select>
<input type="hidden" name="lookfor" value="yes">
<input type="submit" value="查询">
</td>
</form>
</tr>
</table>
</center>
<%
call bgmid()
%>
<center>
<br>
<%
myday1=myday+1
if myyear<>"" then
mydate=myyear & "-" & mymonth & "-" & myday
'mydate1=myyear & "-" & mymonth & "-" & myday1
mydate1=dateadd("d",cdate(mydate),1)
else
mydate=""
end if



Set rs=Server.CreateObject("ADODB.recordset")
sql="select * from senddate where (recipientusername=" & sqlstr(oabusyusername) & " or (recipientusername='所有人' and recipientuserdept=" & sqlstr(oabusyuserdept) & ")) and sender<>" & sqlstr(oabusyusername) & " and reid=0 order by id desc"
if request("lookfor")="yes" then sql="select * from senddate where (recipientusername=" & sqlstr(oabusyusername) & " or (recipientusername='所有人' and recipientuserdept=" & sqlstr(oabusyuserdept) & ")) and sender<>" & sqlstr(oabusyusername) & " and reid=0 and inputdate between " & "#" & mydate & "# and #" & mydate1 & "# order by id desc"
'response.write sql
rs.open sql,conn,1,3
if not rs.eof and not rs.bof then
rs.pagesize=20
page=clng(request("page"))
if page<1 then page=1
if page>rs.pagecount then page=rs.pagecount
href="havercidate.asp"
rs.absolutepage=page
%>
<table border="1" cellpadding="0" cellspacing="0" width="95%">
<tr>
<td align=center><b>公文标题</b></td><td align=center width=30><b>附件</b></td><td align=center width=100><b>发送者所在部门</b></td><td align=center width=60><b>发送者</b></td><td align=center width=150><b>发送日期</b></td>
</tr>
<%
for ipage=1 to rs.pagesize
%>
<tr>
<td><a href="showdate.asp?id=<%=rs("id")%>" target="_blank"><%=rs("title")%></a></td><td align="center">
<%
if rs("filename")<>"" then
%>
<a href="files/<%=rs("filename")%>" target="_blank"><img src="images/attach.gif" width=30 height=30 border=0 alt="文件名:<%=rs("filename")%>"></a>
<%
else
%>

<%
end if
%>
</td><td align="center">
<%

Set rs1=Server.CreateObject("ADODB.recordset")
sql="select name,userdept from userinf where username=" & sqlstr(rs("sender"))
rs1.open sql,conn,1
if not rs1.eof and not rs1.bof then
%>
<%=rs1("userdept")%>
<%
end if
%>
</td>
<td align="center">
<%
if not rs1.eof and not rs1.bof then
%>
<%=rs1("name")%>
<%
end if
%>
</td>
<td align="center"><%=rs("inputdate")%></td>
</tr>
<%
rs.movenext
if rs.eof then exit for
next
%>
</table>
<table border=0 width=550>
<tr><form action=<%=href%> method=get>
<td align="center">
<%
response.write "<a href=" & href & "?page=1&myyear=" & server.urlencode(myyear) & "&mymonth=" &  server.urlencode(mymonth) & "&myday=" & server.urlencode(myday) & "&lookfor=" & server.urlencode(request("lookfor")) & ">第一页</a>"
%>
</td>
<td align="center">
<%
response.write "<a href=" & href & "?page=" & (page-1) & "&myyear=" & server.urlencode(myyear) & "&mymonth=" &  server.urlencode(mymonth) & "&myday=" & server.urlencode(myday) & "&lookfor=" & server.urlencode(request("lookfor")) & ">上一页</a>"
%>
</td>
<td align="center">
<%
response.write "<a href=" & href & "?page=" & (page+1) & "&myyear=" & server.urlencode(myyear) & "&mymonth=" &  server.urlencode(mymonth) & "&myday=" & server.urlencode(myday) & "&lookfor=" & server.urlencode(request("lookfor")) & ">下一页</a>"
%>
</td>
<td align="center">
<%
response.write "<a href=" & href & "?page=" & rs.pagecount & "&myyear=" & server.urlencode(myyear) & "&mymonth=" &  server.urlencode(mymonth) & "&myday=" & server.urlencode(myday) & "&lookfor=" & server.urlencode(request("lookfor")) & ">最后一页</a>"
%>
</td>
<td align="center">
去第<input type=text name=page size=3>页</td>
<input type="hidden" name="myyear" value="<%=myyear%>">
<input type="hidden" name="mymonth" value="<%=mymonth%>">
<input type="hidden" name="myday" value="<%=myday%>">
<input type="hidden" name="lookfor" value="<%=request("lookfor")%>">
<td align="center">第<%=page%>/<%=rs.pagecount%>页</td></form></tr></table><br>



<%
else
%>
<br><br><br>
<table border="0" cellpadding="0" cellspacing="0" width="400">
<tr>
<td width="400" align="center"><font size="4" color="red">对不起,没有相关纪录</font></td></tr></table>
<%
end if
%>


</center>
<%
call bgback()
%>
</body>
</html>
搜索更多相关主题的帖子: SQL 
2005-05-22 10:30
intelwyf
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2005-5-22
收藏
得分:0 
下面是sqlstr.asp的原文
<%
function sqlstr(date)
sqlstr="'" & replace(date,"'","''") & "'"
end function
%>
2005-05-22 10:31
快速回复:请教关于SQL的问题
数据加载中...
 
   



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

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