OleDb.OleDbException 条件表达式中的数据类型不匹配

OleDb.OleDbException Data type mismatch in criteria expression

我想进行这样的查询,但出现错误:

"Select * 
 From Products 
 Where (ProductName)  = '" + productName.Text + "' and  (Revise) = '" + a + "'";

我有产品名称并在 table 作为 2 个不同的列进行修改。

我有几行产品名称相同但修订日期不同。我正在尝试选择正确的。

con.Open();

OleDbCommand select = new OleDbCommand();
select.Connection = con;

Object revize = revizyonlar.SelectedItem;

if(revize != null)
{
    string a = revizyonlar.SelectedItem.ToString();
    System.DateTime b = Convert.ToDateTime(a);
    a = b.Date.ToShortDateString();
    a = "Select * From Products where (ProductName)  = '" + productName.Text + "' and  (Revise) = '" + a + "'";

    select.CommandText = a;
}
else
    select.CommandText = "Select * From Products Where (ProductName)  = '" + productName.Text + "'";

OleDbDataReader reader = select.ExecuteReader();

while (reader.Read())
{
}

日期表达式在 Access 中由 octothorpes 分隔,因此:

a = b.Date.ToString("yyyy'/'MM'/'dd");
a = "Select * From Products Where ProductName = '" + productName.Text + "' And Revise = #" + a + "#";

话虽如此,还是听听Ňɏssa吧。