Solution to random error – “Column does not belong to table “


It has been pretty painful investigating this weird problem – “Column <ColumnName> does not belong to table Table” even though we have this column in the specified table. Sometime it is just throws error – “….table ‘Table'” when there is no such table ‘Table’ in  database.

After thorough investigation many experiments, we found that the root cause of this problem is Corrupted Database Connection Pool.

First reason could be some code is not closing the connection properly, and the other reason could be restarting IIS Server several times without cleaning up the connection pool.

One of the important fact is that just stopping IIS Server will not clean the connection pool. When you restart the IIS Server it will use the pool that was created earlier.

Finally the Solution options are:

1. Use ‘iisreset’ command every time you stop the IIS server
2. Walk through your code and make sure you are closing connection properly.
3. Use ‘Connection Lifetime’ property of connection pool if required.
4. Try to use ClearAllPools/ClearPool in appropriate application event

To learn more on this here are some good links:

* MSDN Connection Pool Lifeguard

* Nice and brief insight on Connection Pool



  1. Found your posting via Google, having the same issue (but only on certain client machines) for a .NET 2.0 Windows Forms application, I’m now putting “ClearAllPools()” calls before functions that do a lot of SQL quieries to see whether it helps.

    • During that time, we also found some thing else. There was a leak in code, one of the connection wasn’t being released. Please go through the code quite thoroughly, I am hoping you will find some leak.
      Another alternative is to try Enterprise Library. It seems to be much more stable.
      Good luck!


Please enter your comment!
Please enter your name here