根据用户名写入数据

shortppsy 2005-08-23 05:43:30
user=trim(request.form("user"))
用户名在数据库内的字段为 "nicheng"

在写入数据库的时候,不知道该用怎么样的查询语句
我这样写是错误的
sql1="select * from member where nicheng="&??????&" order by id desc"

哪位朋友会的,请给个列子,全面点好吗?
我不是很熟悉ASP,谢谢大家了~
...全文
131 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
shine2000 2005-08-23
  • 打赏
  • 举报
回复
Conn1.open SQL1
sql1=sql1="select * from member where nicheng='"& us &"' order by id desc"
?
caobin518 2005-08-23
  • 打赏
  • 举报
回复
你写的代码不规范.

你那长的代码我没有看,你查一下是否有类似的语句:

set conn=server.createobject("adodb.connection")
set rs=server.createoject("adodb.recordset")
shortppsy 2005-08-23
  • 打赏
  • 举报
回复
Set rs1 = Server.CreateObject("Adodb.recordset")
这句已经加了

现在是该页无法显示
haver.G 2005-08-23
  • 打赏
  • 举报
回复
晕倒,你的代码...rs1,conn1,sql1.....哈哈..:)
haver.G 2005-08-23
  • 打赏
  • 举报
回复
在前面加一句Set rs1 = Server.CreateObject("Adodb.recordset")
shortppsy 2005-08-23
  • 打赏
  • 举报
回复
创建了两个数据库连接
一个包括在conn1.asp里
一个在页面里
IT_Fish 2005-08-23
  • 打赏
  • 举报
回复
你确认下定义的数据库连接是conn1还是conn
shortppsy 2005-08-23
  • 打赏
  • 举报
回复
谢谢楼上的几位,顺便帮我看下面这段有什么问题好吗?
马上就搞完收工了.

提示 :rs1.open sql1,Conn1,1,3 有问题 缺少对象: ''
<%
dim sql1
dim sql
dim rs1
dim rs
dim sn
dim password
dim access


sn=trim(request.Form("txtsn"))
password=(trim(Request.Form("txtpwd")))

%>

<!--#include file="conn1.asp"-->
<%
us=trim(request.form("us"))
a=(len(password))
b=(len(sn))
sql="select * from main "
rs.open sql,conn,1,1
if not(rs.bof and rs.eof) then
if password=rs("pwd") and sn=rs("sn") and a=8 and b=8 then
rs.close
conn.close
set rs=nothing
set conn=nothing
id=request.QueryString("id")
SQL1="DBQ="+server.mappath("admin/Shopmember/member.asp")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn1=server.createobject("ADODB.CONNECTION")
Conn1.open SQL1

sql1=sql1="select * from member where nicheng='"& us &"' order by id desc"
rs1.open sql1,Conn1,1,3
rs1("nowmoney")=rs1("nowmoney")+cdbl("20")
rs1("total")=rs1("total")+cdbl("20")
rs1.update
rs1.close

response.write("冲值成功")
else
call Error
end if
else
call Error()
end if
rs.close
conn.close
set rs=nothing
set conn=nothing
%>

<%sub Error() %>
<script language="JavaScript">
alert(' 冲值失败,请检查您的卡号与密码是否正确!')
window.history.go(-1);
</script>
<%end sub%>
yanxunet 2005-08-23
  • 打赏
  • 举报
回复
sql1="select * from member where nicheng='"& user &"' order by id desc"
刚刚错了,
yanxunet 2005-08-23
  • 打赏
  • 举报
回复
sql1="select * from member where nicheng="& user &" order by id desc"
haver.G 2005-08-23
  • 打赏
  • 举报
回复
sql1="select * from member where nicheng='"&??????&"' order by id desc"
加上单引号就好了.

28,391

社区成员

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

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