public void DBint(string temp) { clsMySQL ds = new clsMySQL(); clsMySQL.DBReply dr = ds.QueryDS(temp); GD_CATE.DataSource = dr.dsDataSet.Tables[0].DefaultView; GD_CATE.DataBind(); ds.Close(); }
protected void GD_CATE_PageIndexChanged(object sender, EventArgs e) { clsMySQL db = new clsMySQL(); clsMySQL.DBReply dr = db.QueryDS(global_sql_category); GD_CATE.DataSource = dr.dsDataSet.Tables[0].DefaultView; GD_CATE.DataBind(); ddlBind(GD_CATE); db.Close(); }
protected void GD_CATE_PageIndexChanged(object sender, EventArgs e) { string sql_category = "select * from npi_ep_category where EP_Cate_Stage='" + cate_Stage_DDL.SelectedValue + "' OR ( EP_Cate_Cate='" + Text_Category.Text + "')"; clsMySQL db = new clsMySQL(); clsMySQL.DBReply dr = db.QueryDS(sql_category); GD_CATE.DataSource = dr.dsDataSet.Tables[0].DefaultView; GD_CATE.DataBind(); ddlBind(GD_CATE); db.Close(); }
protected void butSearch_Click(object sender, EventArgs e) { clsMySQL db = new clsMySQL(); string sql_category = ""; sql_category = "select * from npi_ep_category where EP_Cate_Stage='" + cate_Stage_DDL.SelectedValue + "'"; if (Text_Category.Text.Trim() != "" || Text_iit.Text.Trim() != "" || Text_sp.Text.Trim() != "" || Text_md.Text.Trim() != "" || Text_kp.Text.Trim() != "") { if (Text_Category.Text.Trim() != "") { sql_category += " and EP_Cate_Cate='" + Text_Category.Text + "'"; } if (Text_iit.Text.Trim() != "") { sql_category += " and EP_Cate_Iiitems='" + Text_iit.Text + "'"; } if (Text_sp.Text.Trim() != "") { sql_category += " and EP_Cate_SpeChar='" + Text_sp.Text + "'"; } if (Text_md.Text.Trim() != "") { sql_category += " and EP_Cate_Md='" + Text_md.Text + "'"; } if (Text_kp.Text.Trim() != "") { sql_category += " and EP_Cate_KP='" + Text_kp.Text + "'"; } } string stage_value = cate_Stage_DDL.SelectedValue; clsMySQL.DBReply dr = db.QueryDS(sql_category); GD_CATE.DataSource = dr.dsDataSet.Tables[0].DefaultView; GD_CATE.DataBind(); if (GD_CATE.Rows.Count != 0) { ddlBind(GD_CATE); DropDownList ddlSelectPage = (DropDownList)GD_CATE.BottomPagerRow.FindControl("ddlSelectPage"); ddlSelectPage.SelectedIndex = 0; Label label_page = (Label)GD_CATE.BottomPagerRow.FindControl("lblcurPage"); label_page.Text = 1.ToString(); } db.Close(); }
public void DBint(string temp) { //string temp = ""; //temp = Session["value_cate_stage"].ToString(); string sql_category = "select * from npi_ep_category where EP_Cate_Stage='" + temp + "'"; clsMySQL ds = new clsMySQL(); clsMySQL.DBReply dr = ds.QueryDS(sql_category); GD_CATE.DataSource = dr.dsDataSet.Tables[0].DefaultView; GD_CATE.DataBind(); ds.Close(); Session.Clear(); }
protected void butSearch_Click(object sender, EventArgs e) { clsMySQL db = new clsMySQL(); string sql_category = ""; //sql_category = "select * from npi_ep_category where EP_Cate_Stage='" + cate_Stage_DDL.SelectedValue + "'"; /*if (Text_Category.Text.Trim() != "" || Text_iit.Text.Trim() != "" || Text_sp.Text.Trim() != "" || * Text_md.Text.Trim() != "" || Text_kp.Text.Trim() != "") * { * * if (Text_Category.Text.Trim() != "") * { * sql_category += " and EP_Cate_Cate='" + Text_Category.Text + "'"; * } * if (Text_iit.Text.Trim() != "") * { * sql_category += " and EP_Cate_Iiitems='" + Text_iit.Text + "'"; * * } * if (Text_sp.Text.Trim() != "") * { * sql_category += " and EP_Cate_SpeChar='" + Text_sp.Text + "'"; * } * if (Text_md.Text.Trim() != "") * { * sql_category += " and EP_Cate_Md='" + Text_md.Text + "'"; * } * if (Text_kp.Text.Trim() != "") * { * sql_category += " and EP_Cate_KP='" + Text_kp.Text + "'"; * } * }*/ //global_sql_category = sql_category; //string stage_value = cate_Stage_DDL.SelectedValue; if (Stage == "") { string strScript = string.Format("<script language='javascript'>alert('Stage為必填項目!');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } else { clsMySQL.DBReply dr = db.QueryDS(global_sql_category); GD_CATE.DataSource = dr.dsDataSet.Tables[0].DefaultView; GD_CATE.DataBind(); GD_CATE.PageIndex = 0; GridViewRow page = GD_CATE.BottomPagerRow; //如果要從GridView PagerTemplate抓取物件,使用此方法 Label mylabel = (Label)page.Cells[0].FindControl("lblcurPage"); mylabel.Text = Convert.ToString(GD_CATE.PageIndex + 1); if (GD_CATE.Rows.Count != 0) { ddlBind(GD_CATE); DropDownList ddlSelectPage = (DropDownList)GD_CATE.BottomPagerRow.FindControl("ddlSelectPage"); //ddlSelectPage.SelectedIndex = 0; Label label_page = (Label)GD_CATE.BottomPagerRow.FindControl("lblcurPage"); //label_page.Text = 1.ToString(); GD_CATE.PageIndex = 0; } db.Close(); } }