I am having a problem inserting the current date in access database. I have tried every method possible.
This is what i have right now
OleDbConnection vcon = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=abcd.accdb");
private void Form1_Load(object sender, EventArgs e)
{
vcon.Open();
string vsql = string.Format("insert into pending (val1, val2, val3, val4, val5, date) values('{0}', '{1}', '{2}', '{3}', '{4}', @date)", v1.ToString(), v2.ToString(), v3.ToString(), v4.ToString(), v5.ToString());
OleDbCommand vcom = new OleDbCommand(vsql, vcon);
vcom.Parameters.AddWithValue("@date", DateTime.Now);
vcom.ExecuteNonQuery();
vcom.Dispose();
}
it works if i take out the date part. I tried everything, not using a parameter, using ', # , using different formats. What am i doing wrong?