求助!!关于从SQL中读出的数据!!!内祥!!

Sky333 2004-01-01 04:29:36
我从SQL中读出一个数据存放在rs("stupwd")中,执行这条语句session("passwd")=rs("stupwd"),可是当执行if stid=session("stid") and password=session("passwd") then的时候就执行不下去了。(源代码太长了,所以省略)
个位来帮帮小生呀!!!
...全文
68 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
Sky333 2004-01-02
  • 打赏
  • 举报
回复
我用查询分析器SQL建表时可能有错误,
现在我用企业管理器建的表就可以正常操作了!!!!
hackate 2004-01-01
  • 打赏
  • 举报
回复
<%
dim conn
dim connstr
on error resume next
connstr="DBQ="+server.mappath("admin/3jj3jsd9news.asa")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
%>
<%
Set RS = Server.CreateObject("ADODB.RecordSet")
sql="update xinwen set hits=hits+1 where newsid=" & cstr(request("id"))
exec= "select * from xinwen order by newsid="&request("id")
rs.Open exec, Conn, 1,1
text=rs("content")
tmplen1=instr(text,"/**/")
tmplen2=len(text)-tmplen1-3
tmptext1=left(text,tmplen1-1)
tmptext2=right(text,tmplen2)
response.write"<br>"
response.write tmptext1
response.write"<tr><td valign='top'><br><font size=2pt><b>---------- 俱乐部以前消息 ----------</b></font><br>"
set rsc=server.createobject("adodb.recordset")
rsc.open "select top 10 * from xinwen where key like '%" & trim(rs("key")) & "%' and newsid<>" & cstr(rs("newsid")) & " order by ntime DESC",conn,1,1

if rsc.bof and rsc.eof then
response.write "<font size=2pt>暂时没有相关消息</font>"
else
response.write "<ul type=circle>"
do while not rsc.eof
response.write "<li>"
if cstr(rsc("imgcount"))<>0 then
response.write "<font color='#FF0400'>[图文]</font>"
end if
thedate="(" & cstr(year(rsc("ntime"))) & "-" & cstr(month(rsc("ntime"))) & "-" & cstr(day(rsc("ntime"))) & ")"
response.write "<a href='shownews.asp?id=" & cstr(rsc("newsid")) & "' target=_blank>" & trim(rsc("title")) & "</a><font color='#6365CE'>" & thedate & "</font>"
if month(cdate(trim(rs("ntime"))))=month(now()) and clng(day(cdate(trim(rs("ntime"))))+1)>=clng(day(now())) then
response.write "<img src=../images/news.gif><br><br><br><br>"
end if
rsc.movenext
loop
response.write "</ul>"
end if
response.write"</td></tr>"
response.write tmptext2

rsc.close
set rsc=nothing
rs.close
set rs=nothing
conn.close
set conn=nothing
%>

这里面NEWSID并没有做基本的过滤,就是过滤单引号,双引号,请问我该在那里加入过滤语句,请多多指教!谢谢!
我有帖出来的啊,晕哦,怎么没了,好,这个就是!
possible_Y 2004-01-01
  • 打赏
  • 举报
回复
可能是你其他地方的错
最好把附近的代码和浏览器显示的错误信息帖出来
Sky333 2004-01-01
  • 打赏
  • 举报
回复
有!!我用<%=session("stid")%>测试过了,有正确的值!!!
yjgx007 2004-01-01
  • 打赏
  • 举报
回复
session("stid")有赋值吗?如果没有初始化可能会出错

28,407

社区成员

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

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