Windows中使用vb.net的会话 [英] session in windows applcation using vb.net
本文介绍了Windows中使用vb.net的会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好
我正在使用用户名和密码在登录页面的vb.net中使用Windows applcation,我想在下一页中显示该用户名,以及如何使用会话来帮助我
这是我的代码
hello
i am using windows applcation in vb.net in login page using userid and password i want display the userid in next page also how to use session any to help to me
this is my code
Dim com As New SqlCommand("SELECT * FROM Empregistration WHERE EmployeeId ='" & txtuname.Text & "' and password = '" & txtpassword.Text & "'", con)
con.Open()
Dim dr As SqlDataReader = com.ExecuteReader()
If dr.Read Then
session("EmployeeId") = txtuname.Text '(this is correct or not but i gor error in session not decleare_
Empmain.Show()
Me.Hide()
Else
MessageBox.Show("Enter correct username&password")
推荐答案
hi, u can do this way dynamically. Ex:frist Add session
Session.Add("EmployeeId", txtuname.text);
retrieve username from the session and store it in a session variable Session("username") = txtusername.Text // Use this wherever u need Response.Write(Session("username").ToString());
尝试一下:
Try this:
Session.Add("EmployeeId", txtuname.text);
让我知道你这次能得到什么..
and let me know what you get this time..
这篇关于Windows中使用vb.net的会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文