C# VS2008 Windows App: Get error when running method twice
"A column named 'Name' already belongs to this DataTable"
Is there an easy way to avoid getting this when I let the user crun the method twice? Here is the code that errors when repeated. I understand the nature of the message looking for best "practice"\work around.
foreach (FileInfo file in files)
DataRow dr = dt.NewRow();
//get details of each file using file object
dr[Name] = file.FullName;
dr[Size] = file.Length;
dr[Ext] = file.Extension;
dr[Created] = file.LastWriteTime;