asp语句的问题.非常急.~!!

来源:百度知道 编辑:UC知道 时间:2024/06/13 19:10:35
Dim oneid
oneid=trim(Request("oneid"))这是我前面所声明的
后面是
Set Rs = Server.CreateObject("ADODB.Recordset")
If Request("action") = "Find" Then
key = Trim(Request("key"))
If Request("select") = "ISBN" Then
Sql = "Select * From bookInfo Where ISBN Like '%"&key&"%' Order By addtime Desc"
ElseIf Request("select") = "title" Then
Sql = "Select * From bookInfo Where title Like '%"&key&"%' Order By addtime Desc"
ElseIf Request("select") = "author" Then
Sql = "Select * From bookInfo Where author Like '%"&key&"%' Order By addtime Desc"
Else
Response.Write "<Script>alert('查询错误!');</Script>"
Response.End
End If
El

你在
Rs.Open Sql,conn,3,3
上面加上我的代码试试,能不能找出错误的原因
response.write(sql)
response.end()

如果总是输出最后的else,那么一定就是你上面传过来的值没传过来~~你可以先在本页的上面把你想要的变量输出来看看~也许前面的test文本框里的name不对呢~~-_-!

conn存在吗?

我估计是 [字段错误] 看看有没有特殊字符加上 []

然后把字段类型搞清楚

文本 '"&文本字段&"'

数字 "&数字字段&"

再不行 你输出sql 设置个断点 上面那哥们说的