每次尝试列出我的数据库时,为什么我的BlotterDate/Time
列为空。但是在数据库中有数据。
代码:
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if(e.KeyChar == (char)13)
{
if(string.IsNullOrEmpty(textBox1.Text))
{
this.record1TableAdapter.Fill(this.database1DataSet.Record1);
record1BindingSource.DataSource = this.database1DataSet.Record1;
}
else
{
var query = from o in this.database1DataSet.Record1
where o.BlotterNum.ToString().Contains(textBox1.Text) || o.Complainant.Contains(textBox1.Text) || o.Respondent.ToString().Contains(textBox1.Text) || o.Subject.Contains(textBox1.Text) || o._BlotterDate/Time.ToLongTimeString().Contains(textBox1.Text) || o.Facts.ToString().Contains(textBox1.Text)
record1BindingSource.DataSource = query.ToList();
}
}
}
结果如下: