2021年3月3日星期三

C# and MS Access SQL with Date Delimiter

I have encounter an Error with this Query

"SELECT COUNT(*) AS x FROM accounts_info ";          query += "INNER JOIN customers_info ON accounts_info.cust_code = customers_info.cust_code ";          query += "WHERE accounts_info.date_due >= #@a# AND accounts_info.is_paid = 0";    OleDbCommand cmd = new OleDbCommand(query, con);  String aaa = DateTime.Now.ToString("MM/dd/yyyy");  cmd.Parameters.AddWithValue("@a", aaa);  

which an error tells me: Additional information: Syntax error in date in query expression 'accounts_info.date_due >= #@a# AND accounts_info.is_paid = 0'.

Is the a way I can insert a parameter within the date delimiter #1/13/2021# like #@param@# ?

https://stackoverflow.com/questions/66468420/c-sharp-and-ms-access-sql-with-date-delimiter March 04, 2021 at 12:05PM

没有评论:

发表评论