J
jr1024
Hi everybody!
I have a C# app that connects to a mdb file and displays all the
fields from a table
in dataGridView. I have trouble searching in a Access Date/Time field
like this.
string searchDate = "12/11/2007";
Result = DateTime.Parse(Result,
CultureInfo.CurrentCulture).ToShortDateString();
searchDate = "'" + searchDate + "'";
strSQL = "SELECT * FROM TableName WHERE Date=" +
searchDate;
OleDbDataAdapter da = new OleDbDataAdapter(strSQL,
this.conn);
OleDbCommandBuilder cb = new OleDbCommandBuilder(da);
DataSet ds = new DataSet();
da.Fill(ds, "TableName");
I recieve the following error at run-time:
"Data type mismatch in criteria expression"
I guess the problem has something to do with Regional Settengs.
I have a C# app that connects to a mdb file and displays all the
fields from a table
in dataGridView. I have trouble searching in a Access Date/Time field
like this.
string searchDate = "12/11/2007";
Result = DateTime.Parse(Result,
CultureInfo.CurrentCulture).ToShortDateString();
searchDate = "'" + searchDate + "'";
strSQL = "SELECT * FROM TableName WHERE Date=" +
searchDate;
OleDbDataAdapter da = new OleDbDataAdapter(strSQL,
this.conn);
OleDbCommandBuilder cb = new OleDbCommandBuilder(da);
DataSet ds = new DataSet();
da.Fill(ds, "TableName");
I recieve the following error at run-time:
"Data type mismatch in criteria expression"
I guess the problem has something to do with Regional Settengs.