ASP新手问题

来源:百度知道 编辑:UC知道 时间:2024/06/06 18:43:49
错误类型为:语法错误 (操作符丢失) 在查询表达式sql=.....中
<%set conn=server.CreateObject("adodb.connection")
conn.open("provider=microsoft.jet.oledb.4.0;data source="&server.MapPath("msn.mdb"))

dim cvalue
dim cget
cvalue=trim(request.Form("textfield"))
cget=request.Form("radiogroup")

if cget="" then
%>

<script language="javascript">
alert("请选择查询条件!");
history.back;
</script>

<% end if %>
<% if cget<>"" then
if cvalue="" then
%>

<script language="javascript">
alert("请填写查询关键字!");
history.back();
</script>

<% end if
sql="select * form [message] where ["&cget&"] like '%"&cvalue&"%' order by "

我认为应该是这里出了问题
sql="select * form [message] where "'&cget&'" like %"'&cvalue&'"% order by "'&cget&'""
或者这样写
sql="select * form [message] where "+cget+ "like %"+cvalue+"% order by "+cget
因为常量字符串必须用引号加上,而变量则不用,所以分隔开写.
因为我这里现在没有IIs所以不能运行起来试试,很抱歉,希望能够帮助你.

检查上一页的cvalue和cget变量的值

把你的错误提示写全点

SQL语法不对