public void ShowData() { try { conn.Open(); cmd = new SqlCommand(sqlprogram, conn); rdr = cmd.ExecuteReader(); RepeaterProgram.DataSource = rdr; RepeaterProgram.DataBind(); conn.Close(); conn.Open(); cmdTotal = new SqlCommand(sqlTotalTime, conn); object result = cmdTotal.ExecuteScalar(); TimeSpan t = TimeSpan.FromSeconds(Convert.ToDouble(result)); string answer = string.Format("{0:D2}h:{1:D2}m", t.Hours, t.Minutes); LabelTotal.Text = answer; LabelTotal.DataBind(); } catch (Exception ex) { LabelErrMess.Text = ex.Message; } finally { conn.Close(); } }
protected void Page_Load(object sender, EventArgs e) { ProgramRepository objProgramRepository = new ProgramRepository(); if (HttpUtility.UrlDecode(Request.QueryString["id"]) != null) { List <Program> program = new List <Program>(); program.Add(objProgramRepository.GetByProgramID(Convert.ToInt32(HttpUtility.UrlDecode(Request.QueryString["id"])))); RepeaterProgram.DataSource = program; RepeaterProgram.DataBind(); } }