private void button1_Click(object sender, EventArgs e) { string eno = textBox1.Text; var start = dateTimePicker1.Text; var end = dateTimePicker2.Text; if (eno.Length < 4) { MessageBox.Show("请输入4位以上的尾号!"); } else { //var dataTable = logdata.queryByExpressNo(eno, start, end); var dataTable = createdata.queryByExpressNo(eno, start, end); if (dataTable.Rows.Count == 0) { MessageBox.Show("没有搜索到相关条码!"); } else { gdc_data.DataSource = dataTable; } } }