>>>>The help file says that Columns is a collection
>>>>
>>>>see:
http://msdn.microsoft.com/en-us/library/system.data.datacolumncollection.contains(VS.71).aspx>>>
>>>Thanks again. I should have checked the link first.
>>
>>I thought you wanted to check first whether the column existed in order to void the error on the remove
>
>I wanted to figure out why the column didn't exist, since it should, but as a defensive measure I also added this check (changed to Contains right now - yesterday was using !=null instead - and this is after I already read 4 chapters in C# book :()
Here's the (safe) MS way:
if(columns.Contains(columnName))
if(columns.CanRemove(columns[columnName]))
columns.Remove(columnName);
HTH,
Viv