ASP显示记录问题,请高手帮下忙,在线等
代码如下,问题是怎么判断不同用户而显示不同数据,现在我无论登陆哪个用户,这里显示的数据都是相同的。。在WHERE那里该怎么写呢。表是domains字段idusername...
代码如下,问题是怎么判断不同用户而显示不同数据,现在我无论登陆哪个用户,这里显示的数据都是相同的。。在WHERE那里该怎么写呢。
表是domains 字段id username
<% Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from Domains"
rs.open sql,conn,1,1
%>
<body>
<%if rs.EOF and rs.BOF then
response.write ("No Domains")
else
response.write("<table width='100%' bgcolor='#0099FF' border='1' cellspacing='0' cellpadding='0'><tr><td>Id </td><td>UserName </td><td>DomainsName </td><td>Pending/paid</td></tr>")
Do Until rs.EOF
response.write("<tr><td>"&rs("G_domainsid")&"</td><td>"&rs("username")&"</td><td>"&rs("G_domainsname")&"</td><td>"&rs("G_pending")&"/"&rs("G_paid")&"</td></tr>" )
rs.MoveNext
Loop
response.write("</table>")
end if
%> 展开
表是domains 字段id username
<% Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from Domains"
rs.open sql,conn,1,1
%>
<body>
<%if rs.EOF and rs.BOF then
response.write ("No Domains")
else
response.write("<table width='100%' bgcolor='#0099FF' border='1' cellspacing='0' cellpadding='0'><tr><td>Id </td><td>UserName </td><td>DomainsName </td><td>Pending/paid</td></tr>")
Do Until rs.EOF
response.write("<tr><td>"&rs("G_domainsid")&"</td><td>"&rs("username")&"</td><td>"&rs("G_domainsname")&"</td><td>"&rs("G_pending")&"/"&rs("G_paid")&"</td></tr>" )
rs.MoveNext
Loop
response.write("</table>")
end if
%> 展开
展开全部
你先在一个地方获取用户的id
然后代码这样写
<%
id=request("id")
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from Domains where id="&id
rs.open sql,conn,1,1
%>
<body>
<%if rs.EOF or rs.BOF then
response.write ("No Domains")
else
response.write("<table width='100%' bgcolor='#0099FF' border='1' cellspacing='0' cellpadding='0'><tr><td>Id </td><td>UserName </td><td>DomainsName </td><td>Pending/paid</td></tr>")
Do Until rs.EOF
response.write("<tr><td>"&rs("G_domainsid")&"</td><td>"&rs("username")&"</td><td>"&rs("G_domainsname")&"</td><td>"&rs("G_pending")&"/"&rs("G_paid")&"</td></tr>" )
rs.MoveNext
Loop
response.write("</table>")
end if
%>
然后代码这样写
<%
id=request("id")
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from Domains where id="&id
rs.open sql,conn,1,1
%>
<body>
<%if rs.EOF or rs.BOF then
response.write ("No Domains")
else
response.write("<table width='100%' bgcolor='#0099FF' border='1' cellspacing='0' cellpadding='0'><tr><td>Id </td><td>UserName </td><td>DomainsName </td><td>Pending/paid</td></tr>")
Do Until rs.EOF
response.write("<tr><td>"&rs("G_domainsid")&"</td><td>"&rs("username")&"</td><td>"&rs("G_domainsname")&"</td><td>"&rs("G_pending")&"/"&rs("G_paid")&"</td></tr>" )
rs.MoveNext
Loop
response.write("</table>")
end if
%>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<% Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from Domains where username='"&Session("Username")&"'"
rs.open sql,conn,1,1
%>
<body>
<%if rs.EOF and rs.BOF then
response.write ("No Domains")
else
response.write("<table width='100%' bgcolor='#0099FF' border='1' cellspacing='0' cellpadding='0'><tr><td>Id </td><td>UserName </td><td>DomainsName </td><td>Pending/paid</td></tr>")
Do Until rs.EOF
response.write("<tr><td>"&rs("G_domainsid")&"</td><td>"&rs("username")&"</td><td>"&rs("G_domainsname")&"</td><td>"&rs("G_pending")&"/"&rs("G_paid")&"</td></tr>" )
rs.MoveNext
Loop
response.write("</table>")
end if
%>
sql="select * from Domains where username='"&Session("Username")&"'"
rs.open sql,conn,1,1
%>
<body>
<%if rs.EOF and rs.BOF then
response.write ("No Domains")
else
response.write("<table width='100%' bgcolor='#0099FF' border='1' cellspacing='0' cellpadding='0'><tr><td>Id </td><td>UserName </td><td>DomainsName </td><td>Pending/paid</td></tr>")
Do Until rs.EOF
response.write("<tr><td>"&rs("G_domainsid")&"</td><td>"&rs("username")&"</td><td>"&rs("G_domainsname")&"</td><td>"&rs("G_pending")&"/"&rs("G_paid")&"</td></tr>" )
rs.MoveNext
Loop
response.write("</table>")
end if
%>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询