DataTable.Clear() throws System.ArgumentOutOfRangeException

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Clearing a datatable of all data, I would think be a simple task. Does anyone have an idea why the DataTable.Clear() method could throw a System.ArgumentOutOfRangeException. Also, this problem doesn't seem to be consistent or 100% reproducable. Perhaps it depends on the data in the table. Any suggestions? Sorry the description is so vague, but there really is anymore info I can think to add.
 
Huh,

Is your datatable binded, are you implementing its events, calculated
columns, anything?

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com

TALDeveloper said:
Clearing a datatable of all data, I would think be a simple task. Does
anyone have an idea why the DataTable.Clear() method could throw a
System.ArgumentOutOfRangeException. Also, this problem doesn't seem to be
consistent or 100% reproducable. Perhaps it depends on the data in the
table. Any suggestions? Sorry the description is so vague, but there
really is anymore info I can think to add.
 
Yes, the table is bound to a grid. There is a calculation column but it
was added through the grid, not through the datatable. Example:

grid1.Band[0].Columns.Add("CalculatedColumn",typeof(decimal));
 
Hi David,

a) Try detaching datatable from grid before calling clear
b) try removing calculated column before clear
 
Back
Top