| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 4794 人关注过本帖
标题:[求助]ADODB.Recordset (0x800A0BB9)
只看楼主 加入收藏
阳光白雪
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:39
帖 子:2220
专家分:0
注 册:2005-11-18
收藏
得分:0 
[QUOTE]if len(bookname)<>0 and booktype<>"不清楚" and len(publishing)<>0 then
sql="select * from book where bookname like '%"&bookname&"%' and booktype='"&booktype&"' and publishing like '%"&publishing&"%' and bookmoney>="&money1&" and bookmoney<="&money2&" order by bookid desc"
end if
if len(bookname)<>0 and booktype<>"不清楚" and len(publishing)=0 then
sql="select * from book where bookname like '%"&bookname&"%' and booktype='"&booktype&"' and bookmoney>="&money1&" and bookmoney<="&money2&" order by bookid desc"
end if
if len(bookname)<>0 and booktype="不清楚" and len(publishing)<>0 then
sql="select * from book where bookname like '%"&bookname&"%' and publishing like '%"&publishing&"%' and bookmoney>="&money1&" and bookmoney<="&money2&" order by bookid desc"
end if
if len(bookname)<>0 and booktype="不清楚" and len(publishing)=0 then
sql="select * from book where bookname like '%"&bookname&"%' and bookmoney>="&money1&" and bookmoney<="&money2&" order by bookid desc"
end if[/QUOTE]

把这段改成下面的试试:

[QUOTE]Dim Condition
Condition = ""
If Len(bookname)<>0 Then
Condition = Condition & " And bookname like '%"& bookname &"%'"
End If
If booktype<>"不清楚" Then
Condition = Condition & " And booktype='"& booktype &"'"
End If
If Len(publishing)<>0 Then
Condition = Condition & " And publishing like '%"& publishing &"%'"
End If
Sql = "select * from book where bookmoney>="& money1 &" and bookmoney<="& money2 & Condition &" order by bookid desc"[/QUOTE]

专注于WEB前端交互平台开发:[url=http://blog./]blog.[/url](富客户端技术(RIA)交流平台)
2007-04-09 08:49
lily12
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2008-10-26
收藏
得分:0 
急!
最简单的方法Response.write(sql)
看看sql语句是否正确。
如果正确应该怎么办呢?
2008-10-26 17:46
Killbleach
Rank: 2
等 级:论坛游民
帖 子:11
专家分:10
注 册:2009-10-23
收藏
得分:0 
rs.open sql,conn,1,3
更改为
rs.open ,conn,1,3
因为上一行已经有了.
我刚也遇到过
试下吧
2009-10-23 17:17
快速回复:[求助]ADODB.Recordset (0x800A0BB9)
数据加载中...
 
   



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

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