I created a datatable and filled it with contents of a table in a MS Access database table.
My problem started arising when I wanted to add a new row to the datatable: I get an error that my input array is longer than the columns in the table, so I went ahead and checked using a column count on the datatable only to get a zero.
string str = "Select * from Mazda"; OleDbCommand cmd = new OleDbCommand(str, con); OleDbDataAdapter adapt = new OleDbDataAdapter(cmd); adapt.Fill(Mazda);
I tried adding a row using the same format as the datatable in my database
Mazda.Rows.Add(a,b, c, d);
Instead of adding the row, this code throws an error
Input array is longer than the number of columns
How is it possible, if I had already populated the table and how can I fix it?