Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Elusive DataSet
Message
From
30/04/2008 11:22:22
 
General information
Forum:
ASP.NET
Category:
Other
Title:
Environment versions
OS:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
01314012
Message ID:
01314219
Views:
9
This message has been marked as a message which has helped to the initial question of the thread.
>>>>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform