注册 登录
编程论坛 ASP技术论坛

关于数据调用

lish 发布于 2007-12-11 23:01, 608 次点击
" border="0" />

会员注册资料数据表info

" border="0" />

信息发布数据表message

其中message中的info_id等于info中的id,我是用Session保存登陆信息的

我在pro_show.asp加入了
<%
sql="select *  from info where id='"&username&"'"
rs.open sql,conn,1,1
if not rs.eof then%>

在要显示发布信息的公司名称、电话、邮箱的地方加入

公司名称:<%=rs("公司名称")%><br>
电话:<%=rs("电话")%><br>
邮箱:<%=rs("邮箱")%><br>


但是不能调试成功,请高手帮忙砍下错哪里了
5 回复
#2
madpbpl2007-12-11 23:51
username哪来的,它的值是多少呢?
#3
gao5202007-12-12 06:58
sql="select *  from info where username='"&username&"'"
#4
lish2007-12-12 08:48
原帖由 [bold][underline]madpbpl[/underline][/bold] 于 2007-12-11 23:51 发表 [url=http://bbs.bc-cn.net/redirect.php?goto=findpost&pid=1144104&ptid=191952][/url]
username哪来的,它的值是多少呢?


username是登录时的用户名,就是用户名称,值是动态的
#5
madpbpl2007-12-12 10:34
原帖由 [bold][underline]lish[/underline][/bold] 于 2007-12-12 08:48 发表 [url=http://bbs.bc-cn.net/redirect.php?goto=findpost&pid=1144289&ptid=191952][/url]


username是登录时的用户名,就是用户名称,值是动态的

sql="select *  from info where id='"&username&"'"
1.id的类型是数字,首先你这样写就是不对的
2.username楼主并没有声明,这样写肯定是不对的。
试试这样吧
sql="select *  from info where id="&session.session("id")
这个是我猜的。红色的换成楼主定义的session
#6
lish2007-12-12 10:55
回5楼的朋友
我在login时
sql = "Select * From info Where 用户名='"&Username&"' And 密码='"&Password&"'"
set rs=conn.execute (sql)
If rs.EOF Then

就是让用户名=Username,密码=Password

[[italic] 本帖最后由 lish 于 2007-12-12 10:57 编辑 [/italic]]
1