コード例 #1
0
 //绑定批次号
 private void BinddrpPCH()
 {
     try
     {
         DataSet ds = QTCKQuery.GetCHE_QTCKPCH("pch", "", "");
         if (ds != null)
         {
             this.drpPCH.DataSource     = ds;
             this.drpPCH.DataTextField  = "pch";
             this.drpPCH.DataValueField = "pch";
             this.drpPCH.DataBind();
         }
         this.drpPCH.Items.Insert(0, "请选择");
     }
     catch
     {
         this.PrintfError("访问数据出错!");
         return;
     }
 }
コード例 #2
0
    private string GetQueryStr()
    {
        string Querystr = "";

        if (!string.IsNullOrEmpty(txtCKDH.Text))
        {
            Querystr += " and ckdh like '%" + txtCKDH.Text + "%'";
        }
        if (!string.IsNullOrEmpty(txtCPH.Text))
        {
            Querystr += " and cph like '%" + txtCPH.Text + "%'";
        }
        if (drpMDD.SelectedValue != "请选择" && !string.IsNullOrEmpty(drpMDD.SelectedValue))
        {
            Querystr += " and AimAdress like '%" + drpMDD.SelectedValue.ToString() + "%'";
        }
        if (drpCK.SelectedValue != "请选择" && !string.IsNullOrEmpty(drpCK.SelectedValue))
        {
            Querystr += " and ck='" + drpCK.SelectedValue.ToString() + "'";
        }
        if (drpStatus.SelectedValue != "请选择" && !string.IsNullOrEmpty(drpStatus.SelectedValue))
        {
            Querystr += " and STATUS=" + drpStatus.SelectedValue.ToString();
        }
        if (drpZDR.SelectedValue != "请选择" && !string.IsNullOrEmpty(drpZDR.SelectedValue))
        {
            Querystr += " and zdr='" + drpZDR.SelectedValue.ToString() + "'";
        }
        if (drpCKLX.SelectedValue != "请选择" && !string.IsNullOrEmpty(drpCKLX.SelectedValue))
        {
            Querystr += " and cklx='" + drpCKLX.SelectedValue.ToString() + "'";
        }
        if (drpNCDJ.SelectedValue != "请选择" && !string.IsNullOrEmpty(drpNCDJ.SelectedValue))
        {
            Querystr += " and NCDJ='" + drpNCDJ.SelectedValue.ToString() + "'";
        }
        if (!string.IsNullOrEmpty(this.hidZDRQ.Value))
        {
            string ZDRQ1 = txtZDRQ1.Text + " 00:00:00";
            string ZDRQ2 = txtZDRQ2.Text + " 23:59:59";
            Querystr += " and (zdrq>='" + ZDRQ1 + "' and zdrq<='" + ZDRQ2 + "')";
        }
        if (drpPCH.SelectedValue != "请选择")
        {
            string  strpch = "";
            DataSet ds     = QTCKQuery.GetCHE_QTCKPCH("ckdh", "pch", this.drpPCH.SelectedValue);

            if (ds != null)
            {
                int i = 0;
                while (i < ds.Tables[0].Rows.Count)
                {
                    strpch += ds.Tables[0].Rows[i][0].ToString() + ",";
                    i++;
                }
                strpch = strpch.Remove(strpch.Length - 1, 1);
                if (ds.Tables[0].Rows.Count >= 1)
                {
                    Querystr += " and ckdh in('" + strpch + "')";
                }
            }
        }
        return(Querystr);
    }