I want to update records from a csv file.
I do this in a button click:
//Create Adapters
da = new OdbcDataAdapter("Select * FROM test.csv", conn);
//Fill a data table
da.Fill(dt);
//Populate grid with file data
dataGrid1.DataSource = dt;
//Builder
csvBuilder = new OdbcCommandBuilder(da);
// Close the connection
conn.Close();
In another button click I delete some rows:
I loop thru the datarow and call dr.Delete() on the appropiate row and then
call dataGrid1.Refresh() which updates the grid with the remaining rows.
In another button click I want to update the test.csv file I pulled the data
from by doing this:
da.Update(dt);
But it throws this exception:
Additional information: Dynamic SQL generation for the DeleteCommand is not
supported against a SelectCommand that does not return any key column
information.
Does this mean my file needs to have a primary key. It does not, so how do I
update the file.
Thanks