これは私が書いたコードです
private void ViewUsers()
{
con.Open();
SqlCommand com = new SqlCommand();
com.Connection = con;
com.CommandText =
"SELECT FirstName + ' ' + LastName AS Name FROM Clients WHERE UserID=" + Session["userid"];
SqlDataReader data = com.ExecuteReader();
while (data.Read())
{
lblName.Text = data["Name"].ToString();
}
data.Close();
con.Close();
}
private void GetUserType()
{
con.Open();
SqlCommand com = new SqlCommand();
com.Connection = con;
com.CommandText =
"SELECT UserTypeID FROM Users WHERE UserID=" + Session["userid"];
SqlDataReader d2 = com.ExecuteReader();
if (d2["UserTypeID"].ToString() != "4")
{
Response.Redirect("ContactUS.aspx");
}
}
Session["userid"]
から にあるViewUsers()
から値を取得するにはどうすればよいGetUserType
ですか?