Tables.CanRemove

  • Thread starter Thread starter C Glenn
  • Start date Start date
C

C Glenn

I'm doing this:

if ((this.Tables.Contains(dt.TableName)) & (this.Tables.CanRemove(dt)))
{
this.Tables.Remove(dt);
}



and my table is not being removed. Which is fine, I guess. The things
is, I don't know why.

I have confirmed that it is the second portion of the boolean that's
saying no to my request (and, yes, the first portion is returning true).

So what are the possible reasons for CanRemove returning false? By what
criteria does its algorithm evaluate the question?
 
C Glenn,

It's possible that there are constraints on a column which depend on a
column in the table you are trying to remove. You would have to remove
these constraints first, and then you could remove the table.

Hope this helps.
 
No! I used '&'. Thanks for the tip. I looked up '&&' and will use it
in situations like this in future.
 
Back
Top