62,243
社区成员




string strSql = "select * from TM_MeasureInfo where 1=1";
data.Open();
if (string.IsNullOrEmpty(txtCarNumber.Text.Trim()) && string.IsNullOrEmpty(txtMeasureDocID.Text.Trim()))
{
MessageBox.Show("必须输入车号或计量单号","错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
data.Close();
return;
}
else
{
if (!string.IsNullOrEmpty(dateEditStart.Text))
strSql += " and C_RefenceTime>='" + dateEditStart.Text + " 00:00:00'";
if (!string.IsNullOrEmpty(dateEditEnd.Text))
strSql += " and C_RefenceTime<='" + dateEditEnd.Text + " 23:59:59'";
if(!string.IsNullOrEmpty(txtCarNumber.Text.Trim()))
strSql += " and C_CarryNo ='" + txtCarNumber.Text.Trim() + "'";
if (!string.IsNullOrEmpty(txtMeasureDocID.Text.Trim()))
strSql += " and C_MeasureDocID ='" + txtMeasureDocID.Text.Trim() + "'";
dt = data.GetDataTable(strSql);
}
data.Close();