asp.net中读取数据库数据代码

 SqlConnection conn = BaseClass.DBCon();
            conn.Open();
            SqlCommand cmd = new SqlCommand("select * from tb_Student where StudentNum='" + Session["ID"].ToString() + "'", conn);
            SqlDataReader sdr = cmd.ExecuteReader();
            sdr.Read();
            lblName.Text = sdr["StudentName"].ToString();
posted @ 2011-08-08 22:25  风一样的大叔  阅读(199)  评论(0编辑  收藏  举报