为何出现这样的错误!!

fangxianghua9801 2005-11-25 01:25:49
sql = "select * from Products where ID in ("getID.Substring(0,getID.Length-1))")"运行是出现这样的错误:
ASP服务器发现运行时错误:
错 误 码:0x800A0401
错误代码:sql = "select * from Products where ID in ("getID.Substring(0,getID.Length-1))")"
错误描述:语句未结束
文件名称:e:\procrm\shopcart1.asp
所在行号:12
...全文
73 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
swordragon 2005-11-25
  • 打赏
  • 举报
回复
sql = "select * from Products where ID in ('"+getID.Substring(0,getID.Length-1))+"')"
fangxianghua9801 2005-11-25
  • 打赏
  • 举报
回复
ASP服务器发现运行时错误:
错 误 码:0x800A0401
错误代码:sql = "select * from Products where ID in ("+getID.Substring(0,getID.Length-1))+")"
错误描述:语句未结束
文件名称:e:\procrm\shopcart1.asp
所在行号:12
fangxianghua9801 2005-11-25
  • 打赏
  • 举报
回复
<%@ language=vbscript %>
<%
dim StrId,sql
StrId=request("itemno")+","
Session("StrId")=StrId
if len(CStr(Session("StrId")))<>0 then
dim getID
getID=CStr(Session("StrId"))
set conn = Server.CreateObject("ADODB.Connection")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq="&Server.MapPath("myDB/Datasource.mdb")
'sql = "select * from Products where ID="& getID' where ID in ("+getID.Substring(0,getID.Length-1)+")"
sql = "select * from Products where ID in ('"+getID.Substring(0,getID.Length-1))+"')"
set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open sql,conn,1,3
%>
以上使我的源代码,我想实现:sql="select * from Products where ID in (3,8,9)"这样的效果
StrId=request("itemno")+","是接收上页传递的ID值且在后面添上","最终通过此函数getID.Substring(0,getID.Length-1))实现(3,8,9)效果
zhy0101 2005-11-25
  • 打赏
  • 举报
回复
"的问题
swordragon 2005-11-25
  • 打赏
  • 举报
回复
sql = "select * from Products where ID in (" + getID.Substring(0,getID.Length-1) + ")"
peak_weng 2005-11-25
  • 打赏
  • 举报
回复
sql = "select * from Products where ID in ('"+getID.Substring(0,getID.Length-1))+"')"
fangxianghua9801 2005-11-25
  • 打赏
  • 举报
回复
ding
fangxianghua9801 2005-11-25
  • 打赏
  • 举报
回复
ding

110,536

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

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