打印

[asp] [已解决]一个参数传递问题

复制内容到剪贴板
代码:
            news_type=request("news_type")
            if news_type="" then
                sql="select * from news1 order by num desc"
            else
                sql="select * from news1 where news_type="&news_type&" order by num desc"
            end if
帮我看看是那里出错了我这样写就可以找到news_type=10的记录
复制内容到剪贴板
代码:
            news_type=request("news_type")
            if news_type="" then
                sql="select * from news1 where news_type='10' order by num desc"
            else
                sql="select * from news1 where news_type="&news_type&" order by num desc"
            end if
我怀疑是那个参数有问题。
PS:是在charset=utf-8编码下搞的

[ 本帖最后由 zhuerhongyan 于 2008-7-4 10:42 编辑 ]
http://www.seo8858.cn
news_type是整型的话:
sql="select * from news1 where news_type=10 order by num desc"就可以了,不需要单引号
但news_type是文本型的话,那:
sql="select * from news1 where news_type='"&news_type&"' order by num desc"需要加引号。

另外,查看本帖的人都不清楚你说的那些有什么错误和问题,所以帮人解决问题前还需要你说一下出什么错误,提示什么。
乐于助人、严格管理、言多必失。无知者无罪。Keep your waiting,I am come back.
编程资源:http://book.kuhanzhu.com
对管理有异议,请前往事物区进行投诉。请勿PM。
news_type是整型来的,传递的是个数值。没有什么错误提示。只是找不到记录而已。先谢谢斑竹了啊。
http://www.seo8858.cn