public string bin()
{
string sql1 = "";
string str = "";
string qsrq = this.txtQSRQ1.Text.ToString().Trim().Replace("'", "");
string zzrq = this.TEXTZZRQ.Text.ToString().Trim().Replace("'", "");
string tdname = this.tbtdr.Text.ToString().Trim().Replace("'", "");
string jsyxm = this.tbjsy.Text.ToString().Trim().Replace("'", "");
string cph = this.tbcph.Text.ToString().Trim().Replace("'", "");
if (qsrq != "" || zzrq != "")
{
//这里是按照启使日期和终止日期区间进行查询。
//str[1] += " and (fhdate >='" + time1 + "') and ( fhdate<='" + time2 + " 23:59:59')";
str += " and (a.qsrq >= '" + qsrq + "' ) and (a.zzrq<='" + zzrq + "')";
}
if (tdname != "")
{
//填单人查询
str += " and (b.tdnameLIKE '%" + tdname + "%' )";
}
if (jsyxm != "")
{
//驾驶员姓名查询
str += " and (a.jsyxm LIKE '%" + jsyxm + "%' )";
}
if (cph != "")
{
//车牌号查询
str += " and (a.cph LIKE '%" + cph + "%' )";
}
sql1 = @"select b.tdname,a.ccdw,a.sqdw,a.jsyxm,a.qsrq,a.zzrq,a.zd,a.qd,a.cph,a.bid
from CTSP_JCXX AS a inner join CTSP_LC_FCJ AS b
on a.bid=b.bid " + str + " order by qsrq desc";
return sql1;
}