i have a problem here with my code, it happens that if i save an ordinary text or number, it is working, but when i try to save time and dates, an error will occur and saying
My Error
Syntax error in INSERT INTO statement.
here is my code.
//DECLARATIONS3
OleDbDataAdapter da2;
OleDbCommandBuilder cb2;
DataTable dt2 = new DataTable();
//My Syntax
private void btnTotalOrder_Click(object sender, EventArgs e)
{
string time2;
for (int i = 0; i < listView2.Items.Count; i++)
{
ListViewItem lv = listView2.Items[i];
DataRow drNrow = dt2.NewRow();
drNrow[1] = lv.SubItems[0].Text;
drNrow[2] = lv.SubItems[1].Text;
drNrow[3] = lv.SubItems[2].Text;
drNrow[4] = lblreceiptno.Text;
drNrow[5] = txtcname.Text;
drNrow[6] = time2.ToString();
dt2.Rows.Add(drNrow);
[COLOR="red"]da2.Update(dt2);[/COLOR]
dt2.Rows.Clear();
da2.Fill(dt2);
}
}
It points on my DataAdapter.Update(DataTable);