string strconn = "Data Source=PC-201104181242\\SQLEXPRESS;UID=sa;PWD=123;Database=hr";
            SqlConnection cn = new SqlConnection(strconn);
            cn.Open();
            string strsql = "SELECT * FROM [hr].[dbo].[users],[hr].[dbo].[gerenxinxi] where userid='" + TextBox2.Text + "'and userpassword='" + TextBox1.Text + "'and [hr].[dbo].[users].id=[hr].[dbo].[gerenxinxi].id";//这里的查询语句是正确的
            
            SqlCommand cm = new SqlCommand(strsql,cn);
            SqlDataReader dr = cm.ExecuteReader();
            if (dr.Read())
            {
                Session["userid"] = dr["userid"];
                Session["id"] = dr["id"];
                Session["name"] = dr["name"];
                Session["shengqing_id"] = dr["shengqing_id"];
                Session["userpassword"] = dr["userpassword"];
                Session["userpower"] = dr["userpower"];    if ((TextBox1.Text.Trim() == Session["shengqing_id"].ToString().Trim()) && (TextBox2.Text.Trim() == Session["name"].ToString().Trim()))
        {
            string strsql = "INSERT INTO [hr].[dbo].[shenqing]([shengqing_id],[name],[peixun_bianhao]) VALUES ( '" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox7.Text + "') ";            SqlCommand cm = new SqlCommand(strsql, cn);            if ((cm.ExecuteNonQuery()) > 0)
            {
                this.Label1.Text = "信息插入成功!";
            }
        }
        else
        {
            this.Label1.Text = "信息插入失败!";
        }
        cn.Close(); 为什么if的语句不是真,执行后显示的:信息插入失败!";