更新时间:2023-01-27 12:40:22
首先将数据库中的用户ID读入某个DataTable,而不是将用户ID分配给另一个标签......
First read user id from your database into some DataTable, than assign the user id to an other label...
Label2.Text = MyDataTable.Rows[0]["user_id"]
No..
You have to read it from database and the use like this
lblUserID.Text = dt.Rows[0]["user_id"]
成功登录后,在Session中存储所需数据这是在您重定向到新页面之前
When you are successfully logged in then store required data in Session like this before you redirect to new page
Session["FullName"]= //from data
Session[UserId]= //from data
Response.Redirect("NewPage.aspx");
在新页面或任何其他页面,您可以获得此会话
In newpage or any other page you can get this session back
if(Session["FullName"]!=null)
{
string name= Session["FullName"].ToString();
int UserID= Convert.ToInt32(Session["UserId"].ToString());
}