I have a data grid that I should insert its columns values to an access database but I have problem with command.ExecuteNonQuery();
My project is not finished just because of this error. Here is my code :
for (int i = 0; i < (dataGridFactorRent.Rows.Count) - 1; i++)
{
string query =
@"INSERT INTO tbl_RentFactor([ID],DateNow,customerName, objectName,
objectNumber,unitCost,objectCost,paidMoney,restOfMonyy,customerID,DateBack)
VALUES ("+ID+",'" + lbldate.Text + "','" + cmdCustomName.Text + "'," +
dataGridFactorRent.Rows[i].Cells[1].Value + ",
" + dataGridFactorRent.Rows[i].Cells[3].Value + ",
" + dataGridFactorRent.Rows[i].Cells[4].Value + ",
" + dataGridFactorRent.Rows[i].Cells[5].Value + ",
'" + txtPaid.Text + "','" + lblRemained.Text + "',
"+customerID+",'"+lbldate.Text+"')";
con.Open();
command.CommandText =query;
command.ExecuteNonQuery();
con.Close();