Dim strID,strName,strCollege,strMajor,intBalance Session("strID")=conn.execute("select * from users where ID='"&strID&"') Session("strName")=conn.execute("select * from users where Name='"&strName&"') Session("strCollege")=conn.execute("select * from users where College='"&strCollege&"') Session("strMajor")=conn.execute("select * from users where Major='"&strMajor&"') Session("intBalance")=conn.execute("select * from users where Balance='"&intBalance&"'你返回的是一个数据表,确用Session来记录???!!!!建议好好学习一下SQL-_______-!!!
登录页:<% if request("Submit") ="登录" then sql="select * from users where 登录名 = "&"'"&request("name")&"'"&"and 密码="&SQLstr(request("pwd")) set rs = CreateObject("ADODB.Recordset") set rs=conn.execute(sql) if not rs.eof then session("ABCD")=rs("ID")&" "&rs("Name")&" "&rs("College")&" "&rs("Major")&"<br>同学你好,欢迎使用四川大学一卡通系统<br>您的账户余额为"&rs("intBalance") else response.write "<script>" response.write "alert(""没有这个用户或密码错误!"");" response.write "window.location.href='default.asp';" response.write "</script>" end if end if %> 在需要页内使用: <span>登录信息:<%=Session("ABCD")%></span>
Dim strID,strName,strCollege,strMajor,intBalance Session("strID")=conn.execute("select * from users where ID='"&strID&"') Session("strName")=conn.execute("select * from users where Name='"&strName&"') Session("strCollege")=conn.execute("select * from users where College='"&strCollege&"') Session("strMajor")=conn.execute("select * from users where Major='"&strMajor&"') Session("intBalance")=conn.execute("select * from users where Balance='"&intBalance&"' Session("****")这个好像是存的整个表吧
<%Dim strID,strName,strCollege,strMajor,intBalance Session("strID")=conn.execute("select strID from users where ID='"&strID&"') Session("strName")=conn.execute("select strName from users where Name='"&strName&"') Session("strCollege")=conn.execute("select strCollege from users where College='"&strCollege&"') Session("strMajor")=conn.execute("select strMajor from users where Major='"&strMajor&"') Session("intBalance")=conn.execute("select intBalance from users where Balance='"&intBalance&"')Label1.Text=Session("strID") Label2.Text=Session("strName") Label3.Text=Session("strCollege") Label4.Text=Session("strMajor") Label5.Text=Session("intBalance")Response.write strID&" "strName&" "strCollege&" "strMajor&"<br>" Response.write"同学你好,欢迎使用四川大学一卡通系统<br>" Response.write"您的账户余额为"&intBalance %> <form action="data/data_show.asp" name="right" method="post"> <tr> <td></td> <td><asp:Label ID="Label1" runat="server"></asp:Label></td> <td><asp:Label ID="Label2" runat="server"></asp:Label></td> <td><asp:Label ID="Label3" runat="server"></asp:Label></td> <td><asp:Label ID="Label4" runat="server"></asp:Label></td> </tr> </table> </form>
session 一个id就够了吧 剩下的都可以用id查询出来
Dim strID,strName,strCollege,strMajor,intBalance//你这里是干什么呀?定义变量吗???你现在是什么语言?C#里的话,你不能这样定义,变量是要指定类型的,如int strID; Session("strID")=conn.execute("select * from users where ID='"&strID&"') strID=Session("strID")//你这里是做啥????你到底是在什么语言下的嘛?Session["strID"]=conn.execute("select * from users where ID='"&strID&"') strID=Convert.ToInt32(Session["strID"]);//我这里改为C#下使用的//我总感觉楼主的语言不对书,哎,看习惯了C#的优雅,看别的一些语言,还真是有点郁闷了
通过ID取出所有的 dv=conn.execute("select strID from users where ID='"&strID&"') Session["strID"]=dv.table.row[0]["ID"].tostring(); Session["strName"]=dv.table.row[0]["Name"].tostring(); 以下类推 我记得括号是中括号不是小括号
sessionhelp类,可以写成dll以备不时之需!
<!--#include file=路径/其他页.asp -->2. Session的使用,如果Session在其他页成功被赋值,那没在规定时间范围内都可以跨页面使用,例如:
<span>名字:<%=Session("strName")%></span>
Dim strID,strName,strCollege,strMajor,intBalance
Session("strID")=conn.execute("select * from users where ID='"&strID&"')
Session("strName")=conn.execute("select * from users where Name='"&strName&"')
Session("strCollege")=conn.execute("select * from users where College='"&strCollege&"')
Session("strMajor")=conn.execute("select * from users where Major='"&strMajor&"')
Session("intBalance")=conn.execute("select * from users where Balance='"&intBalance&"'你返回的是一个数据表,确用Session来记录???!!!!建议好好学习一下SQL-_______-!!!
if request("Submit") ="登录" then
sql="select * from users where 登录名 = "&"'"&request("name")&"'"&"and 密码="&SQLstr(request("pwd"))
set rs = CreateObject("ADODB.Recordset")
set rs=conn.execute(sql)
if not rs.eof then
session("ABCD")=rs("ID")&" "&rs("Name")&" "&rs("College")&" "&rs("Major")&"<br>同学你好,欢迎使用四川大学一卡通系统<br>您的账户余额为"&rs("intBalance")
else
response.write "<script>"
response.write "alert(""没有这个用户或密码错误!"");"
response.write "window.location.href='default.asp';"
response.write "</script>"
end if
end if
%>
在需要页内使用:
<span>登录信息:<%=Session("ABCD")%></span>
Session("strID")=conn.execute("select * from users where ID='"&strID&"')
Session("strName")=conn.execute("select * from users where Name='"&strName&"')
Session("strCollege")=conn.execute("select * from users where College='"&strCollege&"')
Session("strMajor")=conn.execute("select * from users where Major='"&strMajor&"')
Session("intBalance")=conn.execute("select * from users where Balance='"&intBalance&"'
Session("****")这个好像是存的整个表吧
Session("strID")=conn.execute("select strID from users where ID='"&strID&"')
Session("strName")=conn.execute("select strName from users where Name='"&strName&"')
Session("strCollege")=conn.execute("select strCollege from users where College='"&strCollege&"')
Session("strMajor")=conn.execute("select strMajor from users where Major='"&strMajor&"')
Session("intBalance")=conn.execute("select intBalance from users where Balance='"&intBalance&"')Label1.Text=Session("strID")
Label2.Text=Session("strName")
Label3.Text=Session("strCollege")
Label4.Text=Session("strMajor")
Label5.Text=Session("intBalance")Response.write strID&" "strName&" "strCollege&" "strMajor&"<br>"
Response.write"同学你好,欢迎使用四川大学一卡通系统<br>"
Response.write"您的账户余额为"&intBalance
%>
<form action="data/data_show.asp" name="right" method="post">
<tr>
<td></td>
<td><asp:Label ID="Label1" runat="server"></asp:Label></td>
<td><asp:Label ID="Label2" runat="server"></asp:Label></td>
<td><asp:Label ID="Label3" runat="server"></asp:Label></td>
<td><asp:Label ID="Label4" runat="server"></asp:Label></td>
</tr>
</table>
</form>
剩下的都可以用id查询出来
Session("strID")=conn.execute("select * from users where ID='"&strID&"')
strID=Session("strID")//你这里是做啥????你到底是在什么语言下的嘛?Session["strID"]=conn.execute("select * from users where ID='"&strID&"')
strID=Convert.ToInt32(Session["strID"]);//我这里改为C#下使用的//我总感觉楼主的语言不对书,哎,看习惯了C#的优雅,看别的一些语言,还真是有点郁闷了
dv=conn.execute("select strID from users where ID='"&strID&"')
Session["strID"]=dv.table.row[0]["ID"].tostring();
Session["strName"]=dv.table.row[0]["Name"].tostring();
以下类推 我记得括号是中括号不是小括号
我看的asp上就是这样定义的呀strID我是真的很菜鸟
我压根就不懂这个
逼我写代码
太恼火了