I m working on a project in which I have to use Access Database out of all queries it keeps showing up this Exception
System.Data.OleDb.OleDbException was unhandled
Message = Syntax error in UPDATE statement.
Source = Microsoft Office Access Database Engine
ErrorCode= - 2147217900
In the following query
public static string updateDailyBalance = "UPDATE DailyBalance SET [{0}] = {1} WHERE [CustomerID] = {2} & [PurchaseMonth] = {3}";
and in the following source code
for (int i = 0; i < dsCustomerBal.Tables[0].Rows.Count; i++)
{
//{0} = Day, {1} = BalancePoints, {2} = CustomerID, {3} = yyyyMM
string strQ = Constants.updateDailyBalance;
strQ = strQ.Replace("{0}", l.ToString());
strQ = strQ.Replace("{1}", dsCustomerBal.Tables[0].Rows[i]["Bal"].ToString());
strQ = strQ.Replace("{2}", dsCustomerBal.Tables[0].Rows[i]["CustomerID"].ToString());
strQ = strQ.Replace("{3}", _LastUpdatedDate.ToString("yyyyMM"));
Database db1 = DatabaseFactory.CreateDatabase("Deltin");
DbCommand dbComm1 = db1.GetSqlStringCommand(strQ);
dbComm1.CommandTimeout = 0;
int j = db.ExecuteNonQuery(dbComm1);
}
in the line
int j = db.ExecuteNonQuery(dbComm1);
strQbefore you execute it?