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();
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();