public void LoadProductPhoto() { DataTable dt = dManager.GetOrgPhoto(); DataList2.DataSource = dt; DataList2.DataBind(); }
void vidbind() { int count = 0; SqlConnection con = new SqlConnection(constr); SqlCommand cmd1 = new SqlCommand("select * from LMSCourseregistration where EmployeeMailID = '" + user + "' and [CourseID]='" + Session["urlid"] + "' ", con); con.Open(); count = Convert.ToInt32(cmd1.ExecuteScalar()); con.Close(); if (count == 0) { msglbl.Visible = true; msglbl.Text = "Please register for the course before proceeding to watch videos"; //vid_frame.Visible = false; } else { SqlCommand cmd = new SqlCommand("select * from videostablelms where courseid='" + Request.QueryString["id"] + "'", con); con.Open(); cmd.ExecuteNonQuery(); SqlDataReader sdr = cmd.ExecuteReader(); DataTable videodt = new DataTable(); videodt.Load(sdr); DataList2.DataSource = videodt; DataList2.DataBind(); con.Close(); } }
private void LoadDoctorHopitalDetails(string docEamil) { DataTable dt = _dpManager.GetDoctorHopitalDetails(docEamil); DataList2.DataSource = dt; DataList2.DataBind(); }
//Category Bind on dropdown list public void CategoryDDLDataBind() { try { SqlConnection cn = new SqlConnection(ConnectionString); SqlCommand cmd = new SqlCommand(); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds1 = new DataSet(); cn.Open(); cmd.CommandText = "Select ItemCategory from tbl_Category where ShopID='" + Label11.Text + "'"; cmd.Connection = cn; da = new SqlDataAdapter(cmd); da.Fill(ds1); cmd.ExecuteNonQuery(); DataList2.Dispose(); DataList2.DataSource = ds1; DataList2.DataBind(); cn.Close(); } catch { // lbtotalRow.Text = "No Records Found"; } }
public void loaddata() { string sql = "SELECT BLOG.MaBlog, BLOG.HinhAnh, BLOG.TieuDe, BLOG.TTND, BLOG.NgayDang, TaiKhoan.TenTK FROM BLOG INNER JOIN TaiKhoan ON BLOG.MaTK = TaiKhoan.MaTK"; DataList2.DataSource = XLDL.GetData(sql); DataList2.DataBind(); }
protected void ImageButton2_Click(object sender, ImageClickEventArgs e) { DataTable dt = ds.GetData("Select user_name,first_name,last_name,photo from login l join login_detail ld on l.user_name=ld.username join profile_picture p on l.user_name=p.username join friends f on l.user_name=f.username where f.f_username='******' and (ld.first_name='" + TextBox1.Text + "' or ld.last_name='" + TextBox1.Text + "') and (not(l.user_name='" + Session["username"] + "'))"); DataList2.DataSource = dt; DataList2.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack == false) { id = Request.QueryString["KAtegoriid"]; islem = Request.QueryString["islem"]; } SqlCommand komut = new SqlCommand("Select * From Tbl_Kategoriler", bgl.baglanti()); SqlDataReader oku = komut.ExecuteReader(); DataList2.DataSource = oku; DataList2.DataBind(); //silme işlemi if (islem == "sil") { SqlCommand komutSil = new SqlCommand("Delete from tbl_kategoriler where KategoriId=@p1", bgl.baglanti()); komutSil.Parameters.AddWithValue("@p1", id); komutSil.ExecuteNonQuery(); bgl.baglanti().Close(); } Panel2.Visible = false; Panel4.Visible = false; }
protected void bindFillBlank() { string stuId = Request.Cookies["uId"].Value.ToString(); var result = (from c in db.proc_GetHaveDoFillBlank(stuId) select c).ToList(); DataList2.DataSource = result; DataList2.DataBind(); foreach (DataListItem dl in DataList2.Items) { System.Web.UI.WebControls.Label lbPoint = (System.Web.UI.WebControls.Label)dl.FindControl("Label8"); System.Web.UI.WebControls.Label lbFillBlank = (System.Web.UI.WebControls.Label)dl.FindControl("Label2"); System.Web.UI.WebControls.Label lbPoint1 = (System.Web.UI.WebControls.Label)dl.FindControl("Label7"); int?lbFillBlankID = Convert.ToInt32(lbFillBlank.Text.ToString().Trim()); var result1 = (from c in db.proc_GetPointFillBlankByTitleId(lbFillBlankID) select c).First(); lbPoint1.Text = result1.LevelOnePoint + ">" + result1.LevelTwoPoint; } if (DataList2.Items.Count == 0) { PanelC2.Visible = false; LabelC2.Text = "您还未做作业,请先做作业!"; } }
private void showlap() { DataTable dt = db.selectquery(" select top 5(p.pid),p.img,p.productname,p.category,b.brand,p.rate from Product p join brand b on p.brand = b.Bid where p.category='2' ORDER BY pid ASC"); DataList2.DataSource = dt; DataList2.DataBind(); }
protected void Calendar1_SelectionChanged(object sender, EventArgs e) { dt.Text = Calendar1.SelectedDate.ToString("dd-MM-yyyy"); DataSet ds = new DataSet(); Select sel = new Select(); ds = sel.selectpatt(lblstdnm.Text, lblclass.Text, lblsch.Text, dt.Text); rptitem.DataSource = ds.Tables[0]; rptitem.DataBind(); DataSet ds1 = new DataSet(); Select sel1 = new Select(); ds1 = sel1.selectplv(lblstdnm.Text, lblclass.Text, lblsch.Text); DataList1.DataSource = ds1.Tables[0]; DataList1.DataBind(); DataSet ds2 = new DataSet(); Select sel2 = new Select(); ds2 = sel2.selectplvap(lblstdnm.Text, lblclass.Text, lblsch.Text); DataList2.DataSource = ds2.Tables[0]; DataList2.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { DataList1.DataSource = getProducts(); DataList1.DataBind(); DataList2.DataSource = getCategory(); DataList2.DataBind(); }
public void LoadDB(string type) { pds.DataSource = bll.getAllMenuByType(type); pds.AllowPaging = true; pds.PageSize = 9; pds.CurrentPageIndex = Pages; if (pds.IsFirstPage && pds.IsLastPage) { link_previous.Enabled = false; link_next.Enabled = false; } else if (pds.IsFirstPage) { link_previous.Enabled = false; link_next.Enabled = true; } else if (pds.IsLastPage) { link_previous.Enabled = true; link_next.Enabled = false; } else { link_previous.Enabled = true; link_next.Enabled = true; } pagecount = pds.DataSourceCount; lbl_page.Text = "当前是" + (pds.CurrentPageIndex + 1).ToString() + "页 共有" + pds.PageCount.ToString() + "页 "; DataList2.DataSource = pds; DataList2.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { Panel2.Visible = false; Panel4.Visible = false; if (Page.IsPostBack == false) { id = Request.QueryString["Yemekid"]; islem = Request.QueryString["islem"]; SqlCommand komut = new SqlCommand("Select *From Tbl_Kategoriler", bgl.baglanti()); SqlDataReader dr2 = komut.ExecuteReader(); DropDownList1.DataTextField = "KategoriAd"; DropDownList1.DataValueField = "Kategoriid"; DropDownList1.DataSource = dr2; DropDownList1.DataBind(); } SqlCommand cmd = new SqlCommand("Select *From Tbl_Yemekler", bgl.baglanti()); SqlDataReader dr = cmd.ExecuteReader(); DataList2.DataSource = dr; DataList2.DataBind(); if (islem == "sil") { SqlCommand cmd2 = new SqlCommand("Delete from Tbl_Yemekler where Yemekid=@p1", bgl.baglanti()); cmd2.Parameters.AddWithValue("@p1", id); cmd2.ExecuteNonQuery(); bgl.baglanti().Close(); } }
protected void BtnMainSearch_Click(object sender, EventArgs e) { MultiView1.ActiveViewIndex = 0; if (TextSeaarch.Text == "") { PnlTakipci.Visible = true; lblbosmsg.Visible = true; lblbosmsg.Text = "*Boş geçilemez.Lütfen Aradığınız Kişi'nin Kullanıcı Adı,İsim veya Soyismini Giriniz."; doldur(); DataList2.Visible = false; } else { PnlTakipci.Visible = false; lblbosmsg.Visible = false; DataList2.Visible = true; connect.Open(); SqlDataAdapter asd = new SqlDataAdapter("select * from T_USER TU,T_USER_PROFILE_PHOTO TUPP where TU.ID=TUPP.PROFILE_PHOTO_USER_ID and TU.ID IN (select ID from T_USER where USER_USERNAME like '%" + TextSeaarch.Text + "%' or USER_NAME like '%" + TextSeaarch.Text + "%' or USER_SURNAME like '%" + TextSeaarch.Text + "%')", connect); DataTable dt = new DataTable("tb"); asd.Fill(dt); DataList2.DataSource = dt; DataList2.DataBind(); connect.Close(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int CourseId = Convert.ToInt32(Request.Params["CourseId"]); StuNum = new CourseManege().QueryStuNum(CourseId); coursename.Text = (new CourseManege().queryCourseById(CourseId)).CourseName; List <Model.Class> clalist = new CourseManege().queryClassByCourseId(CourseId); string ClassId; foreach (Model.Class Class in clalist) { ClassId = Class.ClassId; ddlclass.Items.Add(ClassId); } List <Students> stulist = new StudentManage().queryStudentByCourseId(CourseId); foreach (Students stu in stulist) { stu.KqNum = new KqManage().queryStuKqNum(stu.StuId, CourseId); stu.HwNum = new HomeworkManage().queryStuHwNum(stu.StuId, CourseId); } Repeater1.DataSource = stulist; Repeater1.DataBind(); List <Homework> HwList = new HomeworkManage().queryAllHKByTea(CourseId); DataList2.DataSource = HwList; DataList2.DataBind(); List <KQ> KqList = new KqManage().queryAllKq(CourseId); Repeater2.DataSource = KqList; Repeater2.DataBind(); List <JXGG> gglist = new GGManage().LookJXGG(CourseId); Repeater3.DataSource = gglist; Repeater3.DataBind(); } }
private void UserBind() { WX.Main.CurUser.LoadUserModel(false); System.Data.DataTable dt = ULCode.QDA.XSql.GetDataTable("select tu.UserID,tu.RealName,orders.ID,orders.Count cCount from TU_Users tu left join WorkOrder_Orders orders on tu.UserID=orders.ExecUserID and orders.PID=" + Request["OrderID"] + " where DepartmentID=" + WX.Main.CurUser.UserModel.DepartmentID.ToString()); DataList2.DataSource = dt; DataList2.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { TextBox1.Focus(); if (!IsPostBack) { DataList2.DataBind(); cn.Open(); cmd.Connection = cn; cmd.CommandText = "select first_name, last_name from login_detail where username=@username"; cmd.Parameters.AddWithValue("@username", Session["username"].ToString()); Session["firstName"] = ""; // string firstName= cmd.ExecuteScalar().ToString(); reader = cmd.ExecuteReader(); if (reader.Read()) { Session["firstName"] = reader["first_name"].ToString(); } Label1.Text = Session["firstName"].ToString(); Label2.Text = reader["last_name"].ToString(); reader.Close(); cmd.Parameters.Clear(); cmd.CommandText = "select photo from profile_picture where username=@username"; cmd.Parameters.AddWithValue("@username", Session["username"].ToString()); try { string filepath = cmd.ExecuteScalar().ToString(); ImageButton1.ImageUrl = filepath; } catch (Exception ex) { ImageButton1.ImageUrl = "~/profilepic/avatar.jpg"; } cn.Close(); cmd.Parameters.Clear(); { cn.Open(); cmd.Connection = cn; cmd.CommandText = "select count(*) from friends where username=@username"; cmd.Parameters.AddWithValue("@username", Session["username"].ToString()); int count = Convert.ToInt32(cmd.ExecuteScalar()); if (count != 0) { Label3.Visible = false; } else { Label3.Visible = true; Label3.Text = "No Friend to Delete"; } cn.Close(); cmd.Parameters.Clear(); } } }
// 根据订单号查询订单 protected void GetData(string id) { DB db = new DB(); try { string sql = "select s.* from(select *, row_number() over(partition by Id order by BuyDate)as group_idx from Torder) s where s.group_idx = 1 and Id = " + id; db.LoadExecuteData(sql); DataList2.DataKeyField = "Id"; DataList2.DataSource = db.MyDataSet.Tables[0].DefaultView; DataList2.DataBind(); //判断是否为空 if (db.MyDataSet.Tables[0].Rows.Count <= 0) { Image2.Visible = true; } else { Image2.Visible = false; } } catch { Response.Write("<script>alert('查无此单')</script>"); } db.OffData(); }
protected void Page_Load(object sender, EventArgs e) { DataList1.DataSource = XLDL.GetData("select top 3 TT.*,TV.TenTV from TinTuc TT,ThanhVien TV where TV.MaTV = TT.MaTV and Duyet='1' order by NgayDang DESC"); DataList1.DataBind(); DataList2.DataSource = XLDL.GetData("select top 6 BD.*,TV.TenTV from BaiDang BD, ThanhVien TV where TV.MaTV = BD.MaTV and Duyet='1' order by NgayDang DESC"); DataList2.DataBind(); }
protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e) { DataTable cart = (DataTable)Session["cart"]; int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("HiddenField1")).Value); string name = ((Label)e.Item.FindControl("pnameLabel")).Text; int qty = Convert.ToInt32(((DropDownList)e.Item.FindControl("qty")).SelectedValue); int price = Convert.ToInt32(((HiddenField)e.Item.FindControl("HiddenField2")).Value); int total = qty * price; DataRow row; row = cart.NewRow(); row["id"] = id; row["name"] = name; row["qty"] = qty; row["price"] = price; row["total"] = total; cart.Rows.Add(row); DataList2.DataSource = cart; DataList2.DataBind(); Session["cart"] = cart; Label1.Text = cart.Compute("sum(total)", "").ToString(); }
public void CategoryDDLDataBind() { try { //string s = "04/10/2018"; SqlConnection cn = new SqlConnection(ConnectionString); SqlCommand cmd = new SqlCommand(); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds1 = new DataSet(); cn.Open(); cmd.CommandText = "Select ID, Customer_Name,Customer_Mobile,Arrival_Date,Time_Slot, Table_Number from Bookingdetails where Arrival_Date='" + TextBox1.Text + "' and Status='" + "1" + "'"; cmd.Connection = cn; da = new SqlDataAdapter(cmd); da.Fill(ds1); cmd.ExecuteNonQuery(); DataList2.Dispose(); DataList2.DataSource = ds1; DataList2.DataBind(); cn.Close(); } catch { // lbtotalRow.Text = "No Records Found"; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // === modified by jeffery //dsorder = Maticsoft.DBUtility.DbHelperSQL.Query("SELECT Are,count(Are) as 'Sum' FROM Room GROUP BY Are "); QPS.NEW.DAL.SQLHelper sqlHelper = new NEW.DAL.SQLHelper(null); dsorder = sqlHelper.GetDataSet("SELECT Are,count(Are) as 'Sum' FROM Room GROUP BY Are ", CommandType.Text, null); // === DataList2.DataSource = dsorder; DataList2.DataBind(); bind(); //if (Session["username"] ==null) //{ // unLog.Visible = true; // userLoginfo.Visible = false; //} //if (Session["username"] != null) //{ // username = Session["username"].ToString(); // Label1.Text = username; // unLog.Visible = false; // userLoginfo.Visible = true; // string query = "select DContent from Document where DType='5' "; // DataSet doc = Maticsoft.DBUtility.DbHelperSQL.Query(query); // Repeater1.DataSource = doc; // Repeater1.DataBind(); //} } }
protected void BtnMainSearch_Click(object sender, EventArgs e) { MultiView1.ActiveViewIndex = 0; if (TextSeaarch.Text == "") { PnlTakipci.Visible = true; lblbosmsg.Visible = true; lblbosmsg.Text = "*Can not be empty.Please enter the username,name or surname of the person you are searcing."; doldur(); DataList2.Visible = false; } else { PnlTakipci.Visible = false; lblbosmsg.Visible = false; DataList2.Visible = true; connect.Open(); SqlDataAdapter asd = new SqlDataAdapter("select * from T_USER TU,T_USER_PROFILE_PHOTO TUPP where TU.ID=TUPP.PROFILE_PHOTO_USER_ID and TU.ID IN (select ID from T_USER where USER_USERNAME like '%" + TextSeaarch.Text + "%' or USER_NAME like '%" + TextSeaarch.Text + "%' or USER_SURNAME like '%" + TextSeaarch.Text + "%')", connect); DataTable dt = new DataTable("tb"); asd.Fill(dt); DataList2.DataSource = dt; DataList2.DataBind(); connect.Close(); } }
private void AppBind() { System.Data.DataTable dt = ULCode.QDA.XSql.GetDataTable("select * from WorkOrder_Appraisal where WID=" + Request["OrderID"] + " order by AddTime desc"); DataList2.DataSource = dt; DataList2.DataBind(); WX.Main.ExcuteUpdate("WorkOrder_Appraisal", "State=1", "WID=(select ID from WorkOrder_Orders where ID=" + Request["OrderID"] + " and ExecUserID='" + this.CurUser.UserID + "') and State=0"); }
/// <summary> /// 显示产品图片 /// </summary> private void ShowProImg() { Maticsoft.BLL.Products.Product bll = new Maticsoft.BLL.Products.Product(); DataSet ds = bll.GetListByCategoryID(15, ""); PagedDataSource objPds = new PagedDataSource(); objPds.DataSource = ds.Tables[0].DefaultView; objPds.AllowPaging = true; objPds.PageSize = 4; objPds.CurrentPageIndex = 0; DataList2.DataSource = objPds; DataList2.DataBind(); StringBuilder strImg = new StringBuilder(); if (ds.Tables.Count > 0) { int rowcout = ds.Tables[0].Rows.Count; if (rowcout > 0) { for (int n = 0; n < rowcout; n++) { string Name = ds.Tables[0].Rows[n]["Name"].ToString(); string Image = ds.Tables[0].Rows[n]["Image"].ToString(); strImg.Append("<IMG height=130 alt=\"" + Name + "\" src=\"ProductImages/" + Image + "\" width=150 border=0 /> "); } } } strImglist = strImg.ToString(); }
protected void Page_Load(object sender, EventArgs e) { yemekid = Request.QueryString["yemekid"]; SqlCommand komut = new SqlCommand("Select YemekAd From tbl_Yemekler where yemekid=@p1", bgl.baglanti()); komut.Parameters.AddWithValue("@p1", yemekid); SqlDataReader dr = komut.ExecuteReader(); while (dr.Read()) { Label3.Text = dr[0].ToString(); } bgl.baglanti().Close(); //Yorumları listeleme SqlCommand komut2 = new SqlCommand("Select * From Tbl_Yorumlar where yemekid=@p2", bgl.baglanti()); komut2.Parameters.AddWithValue("@p2", yemekid); SqlDataReader dr2 = komut2.ExecuteReader(); DataList2.DataSource = dr2; DataList2.DataBind(); }
protected void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e) { foreach (ListItem list in CheckBoxList1.Items) { if (list.Selected) //if (CheckBoxList1.SelectedItem.Selected) { SqlCommand cmd = new SqlCommand("select * from ProductRegi where PB_Brand_Name='" + CheckBoxList1.SelectedItem.ToString() + "' ", con); con.Open(); SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = cmd; DataSet ds = new DataSet(); da.Fill(ds); UpdatePanel1.Visible = false; UpdatePanel2.Visible = true; DataList2.DataSource = ds; DataList2.DataBind(); con.Close(); } else { // Response.Write("<script>alert('Please Check Above Field')</script>"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["users"] != null) { Label1.Text = Session["users"].ToString(); SqlDataReader dr = data.GetDataReader("select * from Member where MemberName='" + Session["users"].ToString() + "'"); if (dr.Read()) { Label2.Text = dr["MemberMoney"].ToString(); } DataList4.DataSource = data.GetDataReader("select * from v_SCbum where UserName='******'"); DataList4.DataBind(); DataList2.DataSource = data.GetDataReader("select * from CSMusic where UserName='******'"); DataList2.DataBind(); } else { Alert.AlertAndRedirect("对不起您还没有登录", "Login.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataList4.DataSource = data.GetDataReader("select * from Musictype"); DataList4.DataBind(); DataList6.DataSource = data.GetDataReader("select * from Singer"); DataList6.DataBind(); DataList5.DataSource = data.GetDataReader("select * from Album"); DataList5.DataBind(); Datalist3.DataSource = data.GetDataReader("select top 8 * from News"); Datalist3.DataBind(); DataList1.DataSource = data.GetDataReader("select top 6 * from Music where IsCheck='1' order by id desc "); DataList1.DataBind(); DataList2.DataSource = data.GetDataReader("select top 6 * from Music where IsCheck='1' order by clk desc "); DataList2.DataBind(); if (Session["users"] != null) { table2.Visible = true; TABLE1.Visible = false; MName.Text = Session["users"].ToString(); } } }
public void CategoryDDLDataBind() { try { SqlConnection cn = new SqlConnection(ConnectionString); SqlCommand cmd = new SqlCommand(); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds1 = new DataSet(); cn.Open(); cmd.CommandText = "Select CompanyName from tbl_settings where AccountNumber='" + accountnumber + "'"; cmd.Connection = cn; da = new SqlDataAdapter(cmd); da.Fill(ds1); cmd.ExecuteNonQuery(); DataList2.Dispose(); DataList2.DataSource = ds1; DataList2.DataBind(); cn.Close(); } catch { // lbtotalRow.Text = "No Records Found"; } }