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>


以下是出事的代码和运行结果
...全文
54 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
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
月光下的土豆 2009-08-04
  • 打赏
  • 举报
回复
rs.open "select * from [user] where UserName='"&session("user")&"'",conn,1,1

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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