ASP中SQL语句提示From子句错误?

a_kang1798 2009-08-04 03:12:07
<!-- #include file="conn.asp "-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>添加结果</title>
<style type="text/css">
<!-
body {
margin-top: 0px;
margin-bottom: 0px;
background-image: url();
background-repeat: no-repeat;
}

img{ border:0px;}
-->
</style></head>
<body>
<table width="800" border="0" align="center" cellspacing="0">
<tr>
<td width="218" height="72"> </td>
<td width="376"> </td>
<td width="200"> </td>
</tr>
<tr>
<td> </td>
<td align="center" valign="middle">
<%
set rs=server.createobject("adodb.recordset")
rs.open "select * from user where UserName='"&session("user")&"'",conn,1,1
a=rs("UserID")

set rst=Server.CreateObject("ADODB.recordset")

rst.open "productsInfo",conn,1,3
rst.addnew'插入数据到productInfo表
rst("UserID")=a
rst("productName")=request.Form("f_productName")
rst("place")=request.Form("f_place")
rst("grade")=request.Form("f_grade")
rst("price")=request.Form("f_price")
rst("transTime")=request.Form("f_transTime")
rst("address")=request.Form("f_address")
rst("source")=request.Form("f_source")
b=now()
rst("time")=formatdatetime(b,2)
rst.update
rst.close

if err.number<>0 then
%>
<font size="+9" color="red">添加失败</font><br>
<%
else
%>
<font size="+9" color="#339933">添加成功<%=a%></font><br><br>
<a href="createInfo.asp"><img src="image/back.jpg"></a>
<%
end if

set rst = nothing '释放rst这个recordset对象所占得资源
conn.close '关闭conn这个connection对象
set conn=nothing '释放connection对象所占得资源
%></td>
<td> </td>
</tr>
<tr>
<td height="154"> </td>
<td> </td>
<td> </td>
</tr>
</table>
</body>
</html>


以下是出事的代码和运行结果
...全文
26 点赞 收藏 4
写回复
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
sumjor 2009-08-04
rs.open "select * from [user] where UserName='"&session("user")&"'",conn,1,1
回复
homel 2009-08-04
先把sql 语句输出看看
sql="select * from [user] where UserName='"&session("user")&"'"
response.write sql
回复
shenzhenNBA 2009-08-04
rs.open "select * from [user] where UserName='"&session("user")&"'",conn,1,1
回复
rs.open "select * from [user] where UserName='"&session("user")&"'",conn,1,1
回复
发动态
发帖子
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
社区公告
暂无公告