A
Abra
My C# application has a list (ListBox object), connected over a DataView
to a dataset which corresponds to a table from a MySql database. I want
to delete for example 4000-5000 rows from the table, which correspond to
a certain filter.
If I iterate the Rows from the table and check for each one the filter
condition and, if true, I call the Delete() method, it takes several
minutes till the respective rows are deleted. I tried also to create a
second DataView having as RowFilter the condition for the delete. If I
iterate over this second DataView and also Delete() the corresponding
rows, it also takes several minutes to perform.
But if I use a OdbcCommand object (initialized with a "DELETE FROM ...
WHERE (...)" string), call ExecuteNonQuery() and then clear the dataset
and reload it again from the table, it takes only 2-3 seconds to be done
!
Can somebody please explain why the first 2 methods take so long ?
Thanks in advance.
Abra
to a dataset which corresponds to a table from a MySql database. I want
to delete for example 4000-5000 rows from the table, which correspond to
a certain filter.
If I iterate the Rows from the table and check for each one the filter
condition and, if true, I call the Delete() method, it takes several
minutes till the respective rows are deleted. I tried also to create a
second DataView having as RowFilter the condition for the delete. If I
iterate over this second DataView and also Delete() the corresponding
rows, it also takes several minutes to perform.
But if I use a OdbcCommand object (initialized with a "DELETE FROM ...
WHERE (...)" string), call ExecuteNonQuery() and then clear the dataset
and reload it again from the table, it takes only 2-3 seconds to be done
!
Can somebody please explain why the first 2 methods take so long ?
Thanks in advance.
Abra