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"
应该怎么改呢???
...全文
167 点赞 收藏 2
写回复
2 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
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"
回复
相关推荐
发帖
vbScript
创建于2007-09-28

4001

社区成员

它是一种微软环境下的轻量级的解释型语言,它使用COM组件、WMI、WSH、ADSI访问系统中的元素,对系统进行管理。
申请成为版主
帖子事件
创建了帖子
2008-03-22 10:46
社区公告
暂无公告