ASP运行错误:没有为命令对象设置命令?

sndcbu 2004-12-19 12:36:44

1 set cnn1=server.createobject("ADODB.connection")
2 strdsn="DSN=luntan;UID=sa;PWD="
3 cnn1.open strdsn
4 if isEmpty(request.QueryString("action")) then
5 s5="select * from topic where border_id='" & b_no & "' order by post_time desc "
6 else
7 s5=application("s2")
8 end if
9 set rs5=cnn1.execute(s5)

这是我的ASP页面中的部分代码,当运行时提示第9行错误,没有为rs5设置命令,其中Application("s2")的值等于另外一个页面中字符串变量,该字符串跟第5行的语句差不多,不过是在另外一个页面,是不是参数传递不过来的原因啊?我应该怎么解决啊??
请各位大虾多多指教!!
...全文
125 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
班门弄斧 2005-09-01
  • 打赏
  • 举报
回复
mark!
sdliubo 2004-12-19
  • 打赏
  • 举报
回复
是参数传递不过来的原因

用表單傳的 還是url用encode了嗎

csharps 2004-12-19
  • 打赏
  • 举报
回复
不行就用cookie呗.
sndcbu 2004-12-19
  • 打赏
  • 举报
回复
哦,果然是这位大虾所指出的问题啊?
我把case 后面的lastupdate_time 加上""就完全可以啦!
真是太感谢啦!!
fenglik 2004-12-19
  • 打赏
  • 举报
回复
那应该是case "lastupdate_time"
sndcbu 2004-12-19
  • 打赏
  • 举报
回复
case 后面的lastupdate_time是列表框中的值
fenglik 2004-12-19
  • 打赏
  • 举报
回复
如果lastupdate_time等是变量,则lastupdate_time前面没复值

如果lastupdate_time等是字符串常量,则应该是
case "lastupdate_time"
sndcbu 2004-12-19
  • 打赏
  • 举报
回复
奇怪了,什么也输不出来!是空白!
这是我的源代码:请大家看一下:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>调整记录顺序</title>
</head>

<body>
<%
s1=trim(request.QueryString("border_no"))
condtion1=request.Form("select1")
order1=request.Form("select2")
show1=request.Form("select3")
select case condtion1
case lastupdate_time
s6="select * from topic where border_id='" & s1 & "' order by lastupdate_time "
case reply_number
s6="select * from topic where border_id='" & s1 & "' order by reply_number "
case author_name
s6="select * from topic where border_id='" & s1 & "' order by author_name "
case read_number
s6="select * from topic where border_id='" & s1 & "' order by read_number "
case post_time
s6="select * from topic where border_id='" & s1 & "' order by post_time "
case topic_tite
s6="select * from topic where border_id='" & s1 & "' order by topic_tite "
end select
select case order1
case asc1
s6=s6 & "ASC"
case desc1
s6=s6 & "DESC"
end select
application.Lock()
application("s2")=s6
application.UnLock()
response.write s6
%>

</body>
</html>

为什么运行时无法输出变量s6的内容啊?

wen1818 2004-12-19
  • 打赏
  • 举报
回复
先用response.write s5
试试,看输出的是什么
bweigh 2004-12-19
  • 打赏
  • 举报
回复
你先输出一下不就知道到底传过来没有了吗

28,390

社区成员

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

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