Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string[] produceArea = new string[] { projectBad, returnBad };
                DropDownListArea.DataSource = produceArea;
                DropDownListArea.DataBind();


                Debug.WriteLine(sql);
                DataTable dt = new SelectCommandBuilder().ExecuteDataTable(sql);
                GridView1.DataSource = dt;
                GridView1.DataBind();

                string     sqltableSign = @"select  distinct top 10 tableSign  from shatter_Parts
                                where tableSign is not null 
                                and(inputArea = 1) order by tableSign desc ";
                DataTable  dtSign       = new SelectCommandBuilder().ExecuteDataTable(sqltableSign);
                DataColumn sign         = new DataColumn();
                sign.ColumnName = "Sign";
                sign.DataType   = System.Type.GetType("System.String");
                dtSign.Columns.Add(sign);
                var i = 1;
                foreach (DataRow dr in dtSign.Rows)
                {
                    dr["Sign"] = string.Format("{0}", i++);
                }
                DropDownListIndex.DataSource     = dtSign;
                DropDownListIndex.DataValueField = "tableSign";
                DropDownListIndex.DataTextField  = "Sign";
                DropDownListIndex.DataBind();
            }
        }
Exemple #2
0
        protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
        {
            string inputArea1 = "inputArea = 2";
            string inputArea2 = " inputArea = 1";
            string Area       = DropDownListArea.SelectedValue;

            if (Area.Equals(returnBad))
            {
                string     sqltableSign = @"select  distinct top 10 tableSign  from shatter_Parts
                                where tableSign is not null 
                                and(" + inputArea1 + ") order by tableSign desc ";
                DataTable  dtSign       = new SelectCommandBuilder().ExecuteDataTable(sqltableSign);
                DataColumn sign         = new DataColumn();
                sign.ColumnName = "Sign";
                sign.DataType   = System.Type.GetType("System.String");
                dtSign.Columns.Add(sign);
                var i = 1;
                foreach (DataRow dr in dtSign.Rows)
                {
                    dr["Sign"] = string.Format("{0}", i++);
                }
                DropDownListIndex.DataSource     = dtSign;
                DropDownListIndex.DataValueField = "tableSign";
                DropDownListIndex.DataTextField  = "Sign";
                DropDownListIndex.DataBind();
            }
            else
            {
                string     sqltableSign = @"select  distinct top 10 tableSign  from shatter_Parts
                                where tableSign is not null 
                                and (" + inputArea2 + ") order by tableSign desc ";
                DataTable  dtSign       = new SelectCommandBuilder().ExecuteDataTable(sqltableSign);
                DataColumn sign         = new DataColumn();
                sign.ColumnName = "Sign";
                sign.DataType   = System.Type.GetType("System.String");
                dtSign.Columns.Add(sign);
                var i = 1;
                foreach (DataRow dr in dtSign.Rows)
                {
                    dr["Sign"] = string.Format("{0}", i++);
                }
                DropDownListIndex.DataSource     = dtSign;
                DropDownListIndex.DataValueField = "tableSign";
                DropDownListIndex.DataTextField  = "Sign";
                DropDownListIndex.DataBind();
            }
        }