Microsoft VBScript 运行时错误 (0x800A000D)类型不匹配: '[string: "select Pid,PName,PAT"]'

xingYingying 2008-03-22 10:46:42
<%
dim conn
dim connstr
dim db
db=".../Include/data.mdb" '数据库文件的位置
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
conn.Open connstr
dim catid1
dim rs
dim sql
catid1=cint(request.QueryString("catid"))
set rs=server.CreateObject("adodb.recordset")
set sql="select Pid,PName,PATime,PPrice,PStore,PImages,PCatid from Produce where PCatid='"+catid1+"' order by PATime desc"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
rs.close
response.write "<table CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=""100%""><tr><td align=center>对不起,请您先到后台添加商品!</td></tr></table>"
else
%>
<table width="661" height="691" border="1">
<tr>
<td height="627"><table width="610" border="0" cellpadding="7" cellspacing="4" >
<tbody>
<tr>
<%rs.pagesize=9
pagecount=rs.PageCount
page=int(request.QueryString ("page"))
if cint(page)<=1 then page=1
if cint(page)>rs.pagecount then page=rs.pagecount
if request.QueryString("page")="" then
page=1
end if
rs.AbsolutePage=page
dim j
j=0
do while not rs.eof
if j>=4 then exit do
%>
<td align="center" valign="top" border="0"><table width="140" height="140" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="140" width="140" colspan="2" align="center" ><a href="ProSeeAll.asp?id=<% = rs("Pid") %>" target="_blank">
<% if trim(rs("PImages"))<>"" then %>
<img src="../Image\<% = trim(rs("PImages"))%>" border="0" width="100" height="100" /></a>
<% else %>
<img src="../Image/empty.jpg" border="0" width="100" height="100" />
<% end if %>
</td>
</tr>
<tr>
<td align="center"><%=trim(rs("PName"))%></td>
</tr>
<tr>
<td align="center"><% if rs("PStore") > 0 then %>
<table width="100%" border="0" cellspacing="1" cellpadding="1">
<tr>
<td align="center">市场价</span>:<span class="style1"><%=trim(rs("PPrice"))%>元<br />
</td>
</tr>
</table></td>
<%else%>
暂时缺货
<% end if%>
</tr>
</table></td>
<% rs.movenext
j=j+1
if rs.eof then
exit do
end if
loop %>
</tr>
<%
rs.close
%>
<% end if %>
</tbody>
</table></td>
</tr>
</table>


这条语句有问题:set sql="select Pid,PName,PATime,PPrice,PStore,PImages,PCatid from Produce where PCatid='"+catid1+"' order by PATime desc"
应该怎么改呢???
...全文
198 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
snlixing 2008-03-22
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 hookee 的回复:]
变量赋值不需要set
去掉PCateId的单引号,如果它是数字的话
sql="select Pid,PName,PATime,PPrice,PStore,PImages,PCatid from Produce where PCatid=" & catid1 &" order by PATime desc"
[/Quote]
hookee 2008-03-22
  • 打赏
  • 举报
回复
变量赋值不需要set
去掉PCateId的单引号,如果它是数字的话
sql="select Pid,PName,PATime,PPrice,PStore,PImages,PCatid from Produce where PCatid=" & catid1 &" order by PATime desc"

4,008

社区成员

发帖
与我相关
我的任务
社区描述
它是一种微软环境下的轻量级的解释型语言,它使用COM组件、WMI、WSH、ADSI访问系统中的元素,对系统进行管理。
社区管理员
  • vbScript社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧