string id = Request.QueryString["name"]; 
string website = Request.QueryString["website"]; 

SqlConnection conn; SqlCommand cmd; SqlDataReader rd; conn = new SqlConnection("Data Source=JF508-015;Initial Catalog=NetSchool;Integrated Security=True"); conn.Open(); string sqlStr = @"SELECT * FROM [NetSchool].[dbo].[STUDENT] where USERNAME =" + "'" + name + "'" + "and PASSWORD =" + "'" + pass + "'"; cmd = new SqlCommand(sqlStr, conn); rd = cmd.ExecuteReader();
 
  
if (rd.HasRows) {
                rd.Read();
                Session["userName"] = rd["USERID"];
                Response.Redirect("myhome.aspx");
            }
            else
            {
                Label1.Text = "请重新输入用户名和密码";
            }

            rd.Close();
            conn.Close();
            if (Session["userName"] == null)
            {
                Response.Redirect("login.aspx");
            }
            else
            {
                Label1.Text = Session["userName"].ToString();
                Label2.Text = System.DateTime.Now.ToString();
            }
SqlConnection conn;
                SqlCommand cmd;
                SqlDataReader rd;

                string name = Session["userName"].ToString();

                conn = new SqlConnection("Data Source=JF508-015;Initial Catalog=NetSchool;Integrated Security=True");
                conn.Open();
                string sqlStr = @"SELECT *
                                FROM [NetSchool].[dbo].[STUDENT]
                                where USERID =" + name;
                cmd = new SqlCommand(sqlStr, conn);
                rd = cmd.ExecuteReader();
                if (rd.HasRows)
                {
                    Response.Write("");
                    Response.Write("");
                    while (rd.Read())
                    {
                        Response.Write("" + "" + "" + "" + "" + "" + "" + "" + "");                    
                    }
                    Response.Write("
编号姓名密码性别出生日期注册时间专业备注
" + rd["USERID"] + "" + rd["USERNAME"] + "" + rd["PASSWORD"] + "" + rd["SEX"] + "" + rd["BIRTHDAY"] + "" + rd["REGTIME"] + "" + rd["SPECIALTY"] + "" + rd["REMARK"] + "
"); } else { Label1.Text = "请重新输入用户名和密码"; } rd.Close(); conn.Close();

SqlConnection conn;
SqlCommand cmd;
SqlDataReader rd;
string name = Session["userName"].ToString();
conn = new SqlConnection("Data Source=JF508-015;Initial Catalog=NetSchool;Integrated Security=True");
conn.Open();
string sqlStr = @"SELECT *
FROM [NetSchool].[dbo].[STUDENT]
where USERID =" + name;
cmd = new SqlCommand(sqlStr, conn);
rd = cmd.ExecuteReader();
if (rd.HasRows)
{
	Response.Write("");
	Response.Write("");
	while (rd.Read())
	{
		Response.Write("" + "" + "" + "" + "" + "" + "" + "" + "");                    
	}
    Response.Write("
编号姓名密码性别出生日期注册时间专业备注
" + rd["USERID"] + "" + rd["USERNAME"] + "" + rd["PASSWORD"] + "" + rd["SEX"] + "" + rd["BIRTHDAY"] + "" + rd["REGTIME"] + "" + rd["SPECIALTY"] + "" + rd["REMARK"] + "
"); } else { Label1.Text = "请重新输入用户名和密码"; } rd.Close(); conn.Close();

string id = Request.QueryString["name"]; 
string website = Request.QueryString["website"]; 



你可能感兴趣的:(和)