/// <summary> /// 查看当前信息 /// </summary> /// <param name="p"></param> /// <returns></returns> public B_R GetOneB_RInfo(int brid) { B_R br = null; MySqlDataReader mdr = null; MySqlConnection con = MysqlHelper.Connection(); MysqlHelper mh = new MysqlHelper(); mh.OpenConnection(); MySqlCommand msc = new MySqlCommand("select * from b_r where id=" + brid, con); mdr = msc.ExecuteReader(CommandBehavior.CloseConnection); if (mdr.Read()) { int id = mdr.GetInt16("id"); int r_id = mdr.GetInt16("r_id"); int b_id = mdr.GetInt16("b_id"); int isback = mdr.GetInt16("isback"); int numberfirst = mdr.GetInt16("numberfirst"); int numberagain = mdr.GetInt16("numberagain"); int b_booktime = mdr.GetInt32("b_booktime"); long r_booktime = mdr.GetInt64("r_booktime"); br = new B_R(id, r_id, b_id, isback, numberfirst, numberagain, b_booktime, r_booktime); } mh.CloseConnection(); return(br); }
/// <summary> /// 查看所有信息 /// </summary> /// <returns></returns> public List <B_R> GetB_RInfo() { List <B_R> brs = new List <B_R>(); MySqlDataReader mdr = null; MySqlConnection con = MysqlHelper.Connection(); MysqlHelper mh = new MysqlHelper(); mh.OpenConnection(); MySqlCommand msc = new MySqlCommand("select * from b_r", con); mdr = msc.ExecuteReader(CommandBehavior.CloseConnection); while (mdr.Read()) { int id = mdr.GetInt16("id"); int r_id = mdr.GetInt16("r_id"); int b_id = mdr.GetInt16("b_id"); int isback = mdr.GetInt16("isback"); int numberfirst = mdr.GetInt16("numberfirst"); int numberagain = mdr.GetInt16("numberagain"); int b_booktime = mdr.GetInt32("b_booktime"); long r_booktime = mdr.GetInt64("r_booktime"); B_R br = new B_R(id, r_id, b_id, isback, numberfirst, numberagain, b_booktime, r_booktime); brs.Add(br); } mh.CloseConnection(); return(brs); }
protected void Page_Load(object sender, EventArgs e) { if (Session["userid"] == null || Session["username"] == null) { Response.Redirect("/index.aspx", true); } br = new DataB_R().GetOneB_RInfo(int.Parse(Request.QueryString.Get("brid"))); }