北海涠洲岛自由行费用:标准表达式中数据类型不匹配
来源:百度文库 编辑:神马品牌网 时间:2024/04/29 22:03:01
目前,网址:shop/1/?id=“后面为自动编号的shjiaid字段”;
现把该字段更换成用户注册的username字段
系统出现了以下错误,是哪里的问题?
Microsoft JET Database Engine 错误 '80040e07'
标准表达式中数据类型不匹配。
/shop/1/index.asp,行 15
index.asp中代码为:
<%dim id
id=request.QueryString("id")
if not isinteger(id) then
response.write"<script>alert(""非法访问!"");location.href=""../index.asp"";</script>"
end if
set rs_shjia=server.CreateObject("adodb.recordset")
strshjia="select * from shjia where username="&id
rs_shjia.open strshjia,conn,1,1
if rs_shjia.bof and rs_shjia.eof then
response.write"<script>alert(""非法访问!"");location.href=""../index.asp"";</script>"
end if
%>
---------------------------------------------------
第15行为:rs_shjia.open strshjia,conn,1,1 '没修改过
修改过strshjia="select * from shjia where username="&id 中的username,原为shijiaid
便出现以上错误..
.
现把该字段更换成用户注册的username字段
系统出现了以下错误,是哪里的问题?
Microsoft JET Database Engine 错误 '80040e07'
标准表达式中数据类型不匹配。
/shop/1/index.asp,行 15
index.asp中代码为:
<%dim id
id=request.QueryString("id")
if not isinteger(id) then
response.write"<script>alert(""非法访问!"");location.href=""../index.asp"";</script>"
end if
set rs_shjia=server.CreateObject("adodb.recordset")
strshjia="select * from shjia where username="&id
rs_shjia.open strshjia,conn,1,1
if rs_shjia.bof and rs_shjia.eof then
response.write"<script>alert(""非法访问!"");location.href=""../index.asp"";</script>"
end if
%>
---------------------------------------------------
第15行为:rs_shjia.open strshjia,conn,1,1 '没修改过
修改过strshjia="select * from shjia where username="&id 中的username,原为shijiaid
便出现以上错误..
.
username是不是char格式的?如果是需要加单引号的.
strshjia="select * from shjia where username="&id
改成
strshjia="select * from shjia where username='"&id &"'"
试试看
这个问题就是数据类型问题。
在ASP的SQL中:
字符串类型格式需加单引号双引号,如下:
username='"&字符串类型变量&"'
数字型格式只需双引号,如下:
username="&字符串类型变量&"
日期型格式需要加#号和双引号,如下:
username=#"&字符串类型变量&"#