protected void ButtonQuery_Click(object sender, EventArgs e)
    {
        try
        {
            //清除目前選擇DATA
            //this.SelectLabelID.Text = "";
            this.SelectLabelCode.Text = "";
            this.SelectLabelName.Text = "";
            //this.SelectLabelCreateDate.Text = "";
            //this.SelectLabelCreateUID.Text = "";
            //this.SelectLabelUpdateDate.Text = "";
            //this.SelectLabelUpdateUID.Text = "";
            //this.SelectLabelEnable.Text = "";


            //GridView1.PageSize = Convert.ToInt32(TextBoxPagesize.Text.Trim());
            STMModel.MaintainProfitCenter bco = new PIC.VDS2G.GFM.STM.MaintainProfitCenter(ConntionDB);
  
            firstpage = 0;
            firstindex = -1;
            ParameterList.Clear();
            ParameterList.Add(TextBoxCode_ST.Text.Trim());
            ParameterList.Add(TextBoxCode_ED.Text.Trim());
            ParameterList.Add(TextBoxRowCountLimit.Text.Trim());
            databind(bco.QueryProfitCenterByLike2(ParameterList));           
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0];  //直接取第一個
        }
        finally { }
    }//ButtonQuery_Click
    public string ProfitCenterName(string Code)
    {
        string Name = "";
        string ConnectionDBStr = ((DatabaseSettings)ConfigurationManager.GetSection("dataConfiguration")).DefaultDatabase;
        MaintainProfitCenter co_main = new MaintainProfitCenter(ConnectionDBStr);        

        if (Code != "")
        {
            ArrayList ParameterList = new ArrayList();
            ParameterList.Add(Code);

            DataTable dt = co_main.QueryProfitCenterByCode(ParameterList);
            Name = ((dt.Rows.Count > 0) ? dt.Rows[0]["NAME"].ToString() : "查無資料");
        }

        return Name;
    }