protected void Repeater1_ItemCommand1(object source, RepeaterCommandEventArgs e) { if (e.CommandName.ToLower().Equals("xem")) { string id = Convert.ToString(e.CommandArgument); Response.Redirect("Admin_Cauhoichitiet.aspx?macauhoi=" + id + ""); } if (e.CommandName.ToLower().Equals("sua")) { string id = Convert.ToString(e.CommandArgument); Response.Redirect("Admin_chinhsuacauhoi.aspx?macauhoi=" + id + ""); } if (e.CommandName.ToLower().Equals("xoa")) { string id = Convert.ToString(e.CommandArgument); string del = "delete from CAUHOI where IDCauhoi='" + id + "'"; try { ketnoi.executeQuery(del); Response.Write("<script> alert('Xóa thành công!'); window.location.href='Admin_Cauhoi.aspx'; </script>"); } catch { Response.Write("<script> alert('Xóa không thành công!');window.location.href='Admin_Cauhoi.aspx'; </script>"); } } }
protected void btn_capnhat_Click(object sender, EventArgs e) { int id; string sql = "select Max(IDTinmoi) from TINMOI"; DataTable tb_id = ketnoi.getData(sql); try { id = Int32.Parse(tb_id.Rows[0][0].ToString()); } catch { id = 0; } HttpFileCollection fileCollection = Request.Files; for (int i = 0; i < fileCollection.Count; i++) { HttpPostedFile uploadfile = fileCollection[i]; string fileName = Path.GetFileName(uploadfile.FileName); if (uploadfile.ContentLength > 0) { uploadfile.SaveAs(Server.MapPath("~/images/") + fileName); string sql_tinmoi = "insert into TINMOI values('0" + (id + 1) + "',N'" + txt_tieude.Text + "','" + txt_ngaydang.Text + "',N'" + txt_rutgon.Text + "',N'" + txt_doanvan.Text + "','" + fileName + "')"; ketnoi.executeQuery(sql_tinmoi); Response.Write("<script> alert('Thêm mới thành công!'); window.location.href='Admin_tintuc.aspx';</script>"); } else { Response.Write("<script> alert('Thêm mới không thành công!'); window.location.href='Admin_tintuc.aspx';</script>"); } } }
protected void Button1_Click(object sender, EventArgs e) { double id; string sql = "select MAX(IDNguphap) from NGUPHAP"; DataTable tb_id = ketnoi.getData(sql); if (tb_id.Rows[0][0].ToString() == "") { id = 1; } else { id = Int32.Parse(tb_id.Rows[0][0].ToString()) + 1; } string insert = "insert into NGUPHAP values('" + id + "',N'" + txt_noidung.Text + "','','','" + dr_tennguphap.Text + "','Grammar')"; try { ketnoi.executeQuery(insert); Response.Write("<script>alert('Thêm mới thành công'); window.location.href='Admin-Nguphap.aspx' </script>"); } catch { Response.Write("<script>alert('Thêm mới không thành công'); </script>"); } }
protected void Button1_Click(object sender, EventArgs e) { string maxid = "select MAX(IDlienhe) from LIENHE"; DataTable tb_max = ketnoi.getData(maxid); int id; if (tb_max.Rows[0][0].ToString() == "") { id = 1; } else { id = Int32.Parse(tb_max.Rows[0][0].ToString()) + 1; } string lienhe = "insert into LIENHE values('" + id + "',N'" + txt_hoten.Text + "','" + txt_email.Text + "',N'" + txt_nghenghiep.Text + "','" + txt_sodienthoai.Text + "',N'" + txt_noidung.Text + "')"; try { ketnoi.executeQuery(lienhe); Response.Write("<script> alert('Gửi thành công!');</script>"); } catch { Response.Write("<script> alert('Gửi không thành công!');</script>"); } }
protected void btn_Dangky_Click(object sender, EventArgs e) { string kiemtra = "select * from THANHVIEN where Tendangnhap='" + Session["tendangnhap"] + "' and Matkhau='" + txt_matkhaucu.Text + "'"; DataTable tb_kiemtra = ketnoi.getData(kiemtra); if (tb_kiemtra.Rows.Count > 0) { if (txt_matkhaumoi.Text.Trim() != txt_nhaplaimatkhaumoi.Text.Trim()) { Response.Write("<script> alert('Mật khẩu không trùng khớp!')</script>"); } else { string sql = "update THANHVIEN set Matkhau='" + txt_matkhaumoi.Text + "' where Tendangnhap='" + Session["tendangnhap"].ToString() + "'"; try { ketnoi.executeQuery(sql); Response.Write("<script> alert('Mật khẩu đã được thay đổi!'), window.location.href='Default.aspx'; </script>"); } catch { Response.Write("<script> alert('Mật khẩu thay đổi không thành công!')</script>"); } } } else { Response.Write("<script> alert('Mật khẩu không chính xác!')</script>"); } }
protected void btn_Dangky_Click(object sender, EventArgs e) { string id = "select Max(IDThanhvien) from THANHVIEN"; DataTable tb_id = ketnoi.getData(id); int mathanhvien; if (tb_id.Rows.Count == 0) { mathanhvien = 1; } else { mathanhvien = Int32.Parse(tb_id.Rows[0][0].ToString()); } string tendangnhap = "select Tendangnhap from TENDANGNHAP where Tendangnhap='" + Session["Tendangnhap"].ToString() + "'"; DataTable tb_tendangnhap = ketnoi.getData(tendangnhap); if (txt_hoten.Text == "") { Response.Write("<script>alert('Họ tên không được bỏ trống!')</script>"); } else if (txt_tendangnhap.Text == "") { Response.Write("<script>alert('Tên đăng nhập không được bỏ trống')</script>"); } else if (tb_tendangnhap.Rows.Count > 0) { Response.Write("<script>alert('Tên đăng nhập đã tồn tại')</script>"); } else if (txt_matkhau.Text == "") { Response.Write("<script>alert('Mật khẩu không được bỏ trống')</script>"); } else if (txt_matkhau.Text.Trim() != txt_nhaplaimatkhau.Text.Trim()) { Response.Write("<script>alert('Mật khẩu nhập lại không trùng khớp')</script>"); } else { string gioitinh; if (rd_nam.Checked) { gioitinh = "Nam"; } else { gioitinh = "Nữ"; } string dangky = "insert into THANHVIEN values('" + (mathanhvien + 1) + "',N'" + txt_hoten.Text + "','" + txt_tendangnhap.Text + "','" + txt_matkhau.Text + "',2,'" + txt_ngaysinh.Text + "','" + gioitinh + "',N'" + txt_noisinh.Text + "',N'" + txt_diachi.Text + "','" + txt_sodienthoai.Text + "', '" + txt_email.Text + "',N'" + dr_nghenghiep.Text + "')"; try { ketnoi.executeQuery(dangky); Response.Write("<script> alert('Đăng ký thành công!'); </script>"); } catch { Response.Write("<script> alert('Đăng ký không thành công!'); </script>"); } } }
protected void Button1_Click(object sender, EventArgs e) { try { string sql = "update CAUHOI set Phancauhoi=N'" + txt_doanvan.Text + "' where IDCauhoi='1_Conver_98'"; ketnoi.executeQuery(sql); Response.Write("<script>alert('thanh cong') </script>"); } catch { Response.Write("<script>alert('ko thanh cong') </script>"); } }
protected void bnt_Capnhat_Click(object sender, EventArgs e) { string sql = "update THANHVIEN set Matkhau='" + txt_matkhau.Text + "', Phanquyen=" + dr_phanquyen.Text + " where Tendangnhap='" + txt_tendangnhap.Text + "'"; try { ketnoi.executeQuery(sql); Response.Write("<script> alert('Cập nhật thành công!'); window.location.href='Admin_Taikhoan.aspx' </script>"); } catch { Response.Write("<script> alert('Cập nhật không thành công!'); </script>"); } }
protected void btn_capnhat_Click(object sender, EventArgs e) { string id = Request.QueryString["id"]; string update = "update DONGHO set Phut =" + txt_phut.Text + ", Giay=" + txt_giay.Text + " where IdDongho='" + id + "'"; try { ketnoi.executeQuery(update); Response.Write("<script> alert('Cập nhật thành công!'); window.location.href='admin_thoigian.aspx' </script>"); } catch { Response.Write("<script> alert('Cập nhật không thành công!'); window.location.href='admin_thoigian.aspx' </script>"); } }
protected void btn_capnhat_Click(object sender, EventArgs e) { string id = Request.QueryString["id"].ToString(); if (FileUpload1.Visible == true) { HttpFileCollection fileCollection = Request.Files; for (int i = 0; i < fileCollection.Count; i++) { HttpPostedFile uploadfile = fileCollection[i]; string fileName = Path.GetFileName(uploadfile.FileName); if (uploadfile.ContentLength > 0) { uploadfile.SaveAs(Server.MapPath("~/images/") + fileName); string sql_tinmoi = "update KINHNGHIEM set Tieude=N'" + txt_tieude.Text + "',Ngaydang='" + txt_ngaydang.Text + "',Noidungrutgon=N'" + txt_rutgon.Text + "',Noidung=N'" + txt_doanvan.Text + "',Hinhanh='" + fileName + "' where IDKinhnghiem='" + id + "'"; try { ketnoi.executeQuery(sql_tinmoi); Response.Write("<script> alert('Cập nhật thành công!'); window.location.href='Admin_Kinhnghiem.aspx';</script>"); } catch { Response.Write("<script> alert('Cập nhật không thành công!'); window.location.href='Admin_Kinhnghiem.aspx';</script>"); } } } } else { string sql_tinmoi = "update KINHNGHIEM set Tieude=N'" + txt_tieude.Text + "',Ngaydang='" + txt_ngaydang.Text + "',Noidungrutgon=N'" + txt_rutgon.Text + "',Noidung=N'" + txt_doanvan.Text + "' where IDKinhnghiem='" + id + "'"; try{ ketnoi.executeQuery(sql_tinmoi); Response.Write("<script> alert('Cập nhật thành công!'); window.location.href='Admin_Kinhnghiem.aspx';</script>"); } catch { Response.Write("<script> alert('Cập nhật không thành công!'); window.location.href='Admin_Kinhnghiem.aspx';</script>"); } } }
protected void btn_capnhat_Click(object sender, EventArgs e) { string sql_capnhat = "update GIAODIEN set Noidungrutgon=N'" + txt_rutgon.Text + "', Noidung =N'" + txt_doanvan.Text + "' where IdGiaodien='gioithieu'"; try { ketnoi.executeQuery(sql_capnhat); Response.Write("<script> alert('Cập nhật thành công!');</script>"); } catch { Response.Write("<script> alert('Cập nhật không thành công!');</script>"); } }
protected void btn_capnhat_Click(object sender, EventArgs e) { string id = Request.QueryString["id"].ToString(); string update = "update NGUPHAP set Noidung=N'" + txt_noidung.Text + "' where IDNguphap='" + id + "'"; try { ketnoi.executeQuery(update); Response.Write("<script>alert('Cập nhật thành công!'); window.location.href='Admin-Nghuphap.aspx'</script>"); } catch { Response.Write("<script>alert('Cập nhật không thành công!');</script>"); } }
protected void Button1_Click(object sender, EventArgs e) { string tuvung = "insert into TUVUNG values('" + txt_tuvung.Text + "','" + txt_tuvung.Text + "','" + txt_phienam.Text + "','" + txt_loaitu.Text + "',N'" + txt_nghia.Text + "',N'" + txt_vidu.Text + "','Vocabulary','" + dr_chude.Text + "')"; try { ketnoi.executeQuery(tuvung); Response.Write("<script> alert('Thêm từ vựng thành công!'); </script>"); } catch { Response.Write("<script> alert('Thêm từ vựng không thành công!'); </script>"); } }
protected void btn_capnhat_Click(object sender, EventArgs e) { string id = Request.QueryString["id"].ToString(); string update = "update TUVUNG set Tentuvung='" + txt_tuvung.Text + "', Phienam ='" + txt_phienam.Text + "',Loaituvung ='" + txt_loaitu.Text + "',Nghiatuvung=N'" + txt_nghia.Text + "',Vidu='" + txt_vidu.Text + "' where IDTuvung='" + id + "'"; try { ketnoi.executeQuery(update); Response.Write("<script>alert('Cập nhật thành công!'); window.location.href='Admin-Tuvung.aspx'</script>"); } catch { Response.Write("<script>alert('Cập nhật không thành công!');</script>"); } }
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName.ToLower().Equals("xoa")) { string id = Convert.ToString(e.CommandArgument); string del = "delete from LIENHE where IDlienhe='" + id + "'"; try { ketnoi.executeQuery(del); Response.Write("<script> alert('Xóa thành công!'); window.location.href='admin_lienhe.aspx'; </script>"); } catch { Response.Write("<script> alert('Xóa không thành công!');window.location.href='admin_lienhe.aspx'; </script>"); } } }
protected void rpt_tuvung_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName.ToLower().Equals("sua")) { string id = Convert.ToString(e.CommandArgument); Response.Redirect("Admin_ChinhsuaTuvung.aspx?id=" + id.Trim() + ""); } if (e.CommandName.ToLower().Equals("xoa")) { string id = Convert.ToString(e.CommandArgument); string del = "delete from TUVUNG where IDTuvung='" + id + "'"; try { ketnoi.executeQuery(del); Response.Write("<script> alert('Xóa thành công!'); window.location.href='Admin_Tuvung.aspx'; </script>"); } catch { Response.Write("<script> alert('Xóa không thành công!');window.location.href='Admin_Tuvung.aspx'; </script>"); } } }
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName.ToLower().Equals("sua")) { string id = Convert.ToString(e.CommandArgument); Response.Redirect("admin_chinhsuathoigian.aspx?id=" + id + ""); } if (e.CommandName.ToLower().Equals("xoa")) { string id = Convert.ToString(e.CommandArgument); string del = "delete from DONGHO where IDDongho='" + id + "'"; try { ketnoi.executeQuery(del); Response.Write("<script> alert('Xóa thành công!'); window.location.href='admin_thoigian.aspx'; </script>"); } catch { Response.Write("<script> alert('Xóa không thành công!');window.location.href='admin_thoigian.aspx'; </script>"); } } }
protected void btn_Dangky_Click(object sender, EventArgs e) { string gioitinh; if (rd_nam.Checked) { gioitinh = "Nam"; } else { gioitinh = "Nữ"; } string update = "update THANHVIEN set Hoten=N'" + txt_hoten.Text + "',Gioitinh=N'" + gioitinh + "',Ngaysinh='" + txt_ngaysinh.Text + "',Noisinh=N'" + txt_noisinh.Text + "',Diachi=N'" + txt_diachi.Text + "',Nghenghiep=N'" + dr_nghenghiep.Text + "',Email='" + txt_email.Text + "',Sodienthoai='" + txt_sodienthoai.Text + "' where Tendangnhap='" + Session["Tendangnhap"].ToString() + "'"; try { ketnoi.executeQuery(update); Response.Write("<script>alert('Cập nhật thành công!'), window.location.href='Default.aspx' </script>"); } catch { Response.Write("<script>alert('Cập nhật không thành công!'), window.location.href='Default.aspx' </script>"); } }
protected void bnt_Capnhat_Click(object sender, EventArgs e) { string id = Request.QueryString["macauhoi"].ToString(); string sql_update = "update CAUHOI set Phancauhoi=N'" + txt_doanvan.Text + "', Noidung=N'" + txt_cauhoi.Text + "' where IDCauhoi='" + id + "'"; string dapanA, dapanB, dapanC, dapanD; if (rd_TrueA.Checked) { dapanA = "True"; } else { dapanA = "False"; } if (rd_TrueB.Checked) { dapanB = "True"; } else { dapanB = "False"; } if (rd_TrueC.Checked) { dapanC = "True"; } else { dapanC = "False"; } if (rd_TrueD.Checked) { dapanD = "True"; } else { dapanD = "False"; } if (txt_D.Visible == false) { string A = "update DAPAN set NDDA='" + txt_A.Text + "', DA='" + dapanA + "' where IDDA='" + id + "_1'"; string B = "update DAPAN set NDDA='" + txt_B.Text + "', DA='" + dapanB + "' where IDDA='" + id + "_2'"; string C = "update DAPAN set NDDA='" + txt_C.Text + "', DA='" + dapanC + "' where IDDA='" + id + "_3'"; try { ketnoi.executeQuery(sql_update); ketnoi.executeQuery(A); ketnoi.executeQuery(B); ketnoi.executeQuery(C); Response.Write("<script>alert('Cập nhật thành công!'); window.location.href='Admin_Cauhoi.aspx' </script>"); } catch { Response.Write("<script>alert('Cập nhật không thành công!') </script>"); } } else { string A = "update DAPAN set NDDA='" + txt_A.Text + "', DA='" + dapanA + "' where IDDA='" + id + "_1'"; string B = "update DAPAN set NDDA='" + txt_B.Text + "', DA='" + dapanB + "' where IDDA='" + id + "_2'"; string C = "update DAPAN set NDDA='" + txt_C.Text + "', DA='" + dapanC + "' where IDDA='" + id + "_3'"; string D = "update DAPAN set NDDA='" + txt_D.Text + "', DA='" + dapanD + "' where IDDA='" + id + "_4'"; try { ketnoi.executeQuery(sql_update); ketnoi.executeQuery(A); ketnoi.executeQuery(B); ketnoi.executeQuery(C); ketnoi.executeQuery(D); Response.Write("<script>alert('Cập nhật thành công!'); window.location.href='Admin_Cauhoi.aspx' </script>"); } catch { Response.Write("<script>alert('Cập nhật không thành công!') </script>"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string id = Request.QueryString["dethi"]; try { sodiemdoc = Double.Parse(Session["diemdoc"].ToString()); sodiemnghe = Double.Parse(Session["diemnghe"].ToString()); tongdiem = Double.Parse(Session["diemdoc"] + Session["diemnghe"].ToString()); sodiem = ((Double.Parse(Session["diemdoc"].ToString()) + Double.Parse(Session["diemnghe"].ToString())) * 0.1) + 1; tongdiemdoc = (Double.Parse(Session["diemdoc"].ToString()) * 0.2) + 1; tongdiemnghe = (Double.Parse(Session["diemnghe"].ToString()) * 0.2) + 1; } catch { } try { string sql_filenghe = "select * from FILES where IDFile='Nghe_" + id + "'"; Repeater1.DataSource = ketnoi.getData(sql_filenghe); Repeater1.DataBind(); } catch { } diemthi.Visible = false; string sql_Phutnghe = "select * from DONGHO where IDDongho='02'"; rpt_donghonghe.DataSource = ketnoi.getData(sql_Phutnghe); rpt_donghonghe.DataBind(); string sql_Phutdoc = "select * from DONGHO where IDDongho='01'"; rpt_donghodoc.DataSource = ketnoi.getData(sql_Phutdoc); rpt_donghodoc.DataBind(); phandoc.Visible = false; phannghe.Visible = false; btn_Nopbai.Visible = false; string sql_mathoigian = "select IDThoigian from THOIGIAN Order by IDThoigian DESC"; DataTable tb_mathoigian = ketnoi.getData(sql_mathoigian); if (tb_mathoigian.Rows.Count < 1) { stt = 1; } else { stt = Int32.Parse(tb_mathoigian.Rows[0][0].ToString()) + 1; } string thoigian = "insert into Thoigian(IDThoigian) values('" + stt + "')"; ketnoi.executeQuery(thoigian); //Phần nghe string sql_hinhanh = "select A.IDCauhoi,C.IDNoidungchitiet, A.Phancauhoi, RTRIM(B.Tenfile)as Tenfile,A.Noidung from CAUHOI A, FILES B, CHITIETNOIDUNG C where A.IDNoidung='Photographstest' and C.IDNoidungchitiet=A.IDNoidung and A.IDFile=B.IDFile and Made='" + id + "' order by A.IDCauhoi ASC"; Rpt_nghe_hinhanh.DataSource = ketnoi.getData(sql_hinhanh); Rpt_nghe_hinhanh.DataBind(); for (int i = 0; i < Rpt_nghe_hinhanh.Items.Count; i++) { Label a = (Label)Rpt_nghe_hinhanh.Items[i].FindControl("A"); Label b = (Label)Rpt_nghe_hinhanh.Items[i].FindControl("B"); Label c = (Label)Rpt_nghe_hinhanh.Items[i].FindControl("C"); Label d = (Label)Rpt_nghe_hinhanh.Items[i].FindControl("D"); string sql = "select * from DAPAN where IDCauhoi ='1_" + (i + 1) + "'"; DataTable tb = ketnoi.getData(sql); a.Text = tb.Rows[0]["NDDA"].ToString(); b.Text = tb.Rows[1]["NDDA"].ToString(); c.Text = tb.Rows[2]["NDDA"].ToString(); d.Text = tb.Rows[3]["NDDA"].ToString(); } string sql_cauhoi = "select C.IDNoidungchitiet, A.Phancauhoi, RTRIM(B.Tenfile)as Tenfile,A.Noidung from CAUHOI A, FILES B, CHITIETNOIDUNG C where A.IDNoidung='Questiontest' and C.IDNoidungchitiet=A.IDNoidung and A.IDFile=B.IDFile and Made='" + id + "' order by A.IDCauhoi ASC"; rpt_nghe_cauhoi.DataSource = ketnoi.getData(sql_cauhoi); rpt_nghe_cauhoi.DataBind(); for (int i = 0; i < rpt_nghe_cauhoi.Items.Count; i++) { Label a = (Label)rpt_nghe_cauhoi.Items[i].FindControl("A"); Label b = (Label)rpt_nghe_cauhoi.Items[i].FindControl("B"); Label c = (Label)rpt_nghe_cauhoi.Items[i].FindControl("C"); string sql = "select * from DAPAN where IDCauhoi ='1_" + (11 + i) + "'"; DataTable tb = ketnoi.getData(sql); a.Text = tb.Rows[0]["NDDA"].ToString(); b.Text = tb.Rows[1]["NDDA"].ToString(); c.Text = tb.Rows[2]["NDDA"].ToString(); } string sql_hoithoai = "select C.IDNoidungchitiet, A.Phancauhoi, RTRIM(B.Tenfile)as Tenfile,A.Noidung from CAUHOI A, FILES B, CHITIETNOIDUNG C where A.IDNoidung='Conversationtest' and C.IDNoidungchitiet=A.IDNoidung and A.IDFile=B.IDFile and Made='" + id + "' order by A.IDCauhoi ASC"; rpt_nghehoithoai.DataSource = ketnoi.getData(sql_hoithoai); rpt_nghehoithoai.DataBind(); for (int i = 0; i < rpt_nghehoithoai.Items.Count; i++) { Label a = (Label)rpt_nghehoithoai.Items[i].FindControl("A"); Label b = (Label)rpt_nghehoithoai.Items[i].FindControl("B"); Label c = (Label)rpt_nghehoithoai.Items[i].FindControl("C"); Label d = (Label)rpt_nghehoithoai.Items[i].FindControl("D"); string sql = "select * from DAPAN where IDCauhoi ='1_" + (41 + i) + "'"; DataTable tb = ketnoi.getData(sql); a.Text = tb.Rows[0]["NDDA"].ToString(); b.Text = tb.Rows[1]["NDDA"].ToString(); c.Text = tb.Rows[2]["NDDA"].ToString(); } string sql_doanvan = "select C.IDNoidungchitiet, A.Phancauhoi, RTRIM(B.Tenfile)as Tenfile,A.Noidung from CAUHOI A, FILES B, CHITIETNOIDUNG C where A.IDNoidung='Talktest' and C.IDNoidungchitiet=A.IDNoidung and A.IDFile=B.IDFile and Made='" + id + "' order by A.IDCauhoi ASC"; rpt_nghedoanvan.DataSource = ketnoi.getData(sql_doanvan); rpt_nghedoanvan.DataBind(); for (int i = 0; i < rpt_nghedoanvan.Items.Count; i++) { Label a = (Label)rpt_nghedoanvan.Items[i].FindControl("A"); Label b = (Label)rpt_nghedoanvan.Items[i].FindControl("B"); Label c = (Label)rpt_nghedoanvan.Items[i].FindControl("C"); Label d = (Label)rpt_nghedoanvan.Items[i].FindControl("D"); string sql = "select * from DAPAN where IDCauhoi ='1_" + (71 + i) + "'"; DataTable tb = ketnoi.getData(sql); a.Text = tb.Rows[0]["NDDA"].ToString(); b.Text = tb.Rows[1]["NDDA"].ToString(); c.Text = tb.Rows[2]["NDDA"].ToString(); } //Phần đọc string sql_doc = "select * from CAUHOI where IDNoidung='Sentencestest' and Made='" + id + "'"; rpt_phandoc.DataSource = ketnoi.getData(sql_doc); rpt_phandoc.DataBind(); for (int i = 0; i < rpt_phandoc.Items.Count; i++) { Label a = (Label)rpt_phandoc.Items[i].FindControl("A"); Label b = (Label)rpt_phandoc.Items[i].FindControl("B"); Label c = (Label)rpt_phandoc.Items[i].FindControl("C"); Label d = (Label)rpt_phandoc.Items[i].FindControl("D"); string sql = "select * from DAPAN where IDCauhoi ='1_" + (101 + i) + "'"; DataTable tb = ketnoi.getData(sql); a.Text = tb.Rows[0]["NDDA"].ToString(); b.Text = tb.Rows[1]["NDDA"].ToString(); c.Text = tb.Rows[2]["NDDA"].ToString(); d.Text = tb.Rows[3]["NDDA"].ToString(); } string sql_docdientu = "select * from CAUHOI where IDNoidung='TextCompletiontest' and Made='" + id + "'"; rpt_docdientu.DataSource = ketnoi.getData(sql_docdientu); rpt_docdientu.DataBind(); for (int i = 0; i < rpt_docdientu.Items.Count; i++) { Label a = (Label)rpt_docdientu.Items[i].FindControl("A"); Label b = (Label)rpt_docdientu.Items[i].FindControl("B"); Label c = (Label)rpt_docdientu.Items[i].FindControl("C"); Label d = (Label)rpt_docdientu.Items[i].FindControl("D"); try { string sql = "select * from DAPAN where IDCauhoi ='1_14" + (i + 1) + "'"; DataTable tb = ketnoi.getData(sql); a.Text = tb.Rows[0]["NDDA"].ToString(); b.Text = tb.Rows[1]["NDDA"].ToString(); c.Text = tb.Rows[2]["NDDA"].ToString(); d.Text = tb.Rows[3]["NDDA"].ToString(); } catch { } } string sql_docdoanvan = "select * from CAUHOI where IDNoidung='SinglePassagetest' and Made='" + id + "'"; rpt_docdoanvan.DataSource = ketnoi.getData(sql_docdoanvan); rpt_docdoanvan.DataBind(); for (int i = 0; i < rpt_docdoanvan.Items.Count; i++) { Label a = (Label)rpt_docdoanvan.Items[i].FindControl("A"); Label b = (Label)rpt_docdoanvan.Items[i].FindControl("B"); Label c = (Label)rpt_docdoanvan.Items[i].FindControl("C"); Label d = (Label)rpt_docdoanvan.Items[i].FindControl("D"); try { string sql = "select * from DAPAN where IDCauhoi ='1_" + (153 + i) + "' and Made='" + id + "'"; DataTable tb = ketnoi.getData(sql); a.Text = tb.Rows[0]["NDDA"].ToString(); b.Text = tb.Rows[1]["NDDA"].ToString(); c.Text = tb.Rows[2]["NDDA"].ToString(); d.Text = tb.Rows[3]["NDDA"].ToString(); } catch { } } string sql_docdoanvan1 = "select * from CAUHOI where IDNoidung='DoublePassagetest' and Made='" + id + "'"; rpt_docdoanvan.DataSource = ketnoi.getData(sql_docdoanvan1); rpt_docdoanvan.DataBind(); for (int i = 0; i < rpt_docdoanvan.Items.Count; i++) { Label a = (Label)rpt_docdoanvan.Items[i].FindControl("A"); Label b = (Label)rpt_docdoanvan.Items[i].FindControl("B"); Label c = (Label)rpt_docdoanvan.Items[i].FindControl("C"); Label d = (Label)rpt_docdoanvan.Items[i].FindControl("D"); try { string sql = "select * from DAPAN where IDCauhoi ='1_" + (153 + i) + "' and Made='" + id + "'"; DataTable tb = ketnoi.getData(sql); a.Text = tb.Rows[0]["NDDA"].ToString(); b.Text = tb.Rows[1]["NDDA"].ToString(); c.Text = tb.Rows[2]["NDDA"].ToString(); d.Text = tb.Rows[3]["NDDA"].ToString(); } catch { } } } }