asp 标准表达式中数据类型不匹配。的问题

来源:百度知道 编辑:UC知道 时间:2024/05/18 10:42:45
代码如下
<%
dim artid
if request.QueryString("id")<>"" then
artid=Clng(trim(request.QueryString("id")))
else
artid=1
end if
%>
<%Sql="Select * from art where id='"&artid&"'"%> 59是这行
<%Set Rs=conn.execute(Sql)%>
<%response.Write(Typename(Rs("id")))%>
<%if not rs.eof then%>
<%=rs("arttitle")%>
<%else%>
<%response.Write("暂无")%>
<%end if%>
运行之后提示
我喜爱的文章

Microsoft JET Database Engine 错误 '80040e07'
标准表达式中数据类型不匹配。

/readart.asp,行 59
去掉"也是一样的效果

artid类型应该是去掉空格的字符串,去掉Clng
<%Sql="Select * from art where id="&artid%>
就对了

数据库中的字段
数字类型不用加''
字符类型才加''

<%Sql="Select * from art where id="&artid%>