DBCommandWrapper is not defined after installing Enterprise Library 4.0

Topics: Enterprise Library Core
Dec 7, 2011 at 2:28 PM


My application uses references from Enterprise Library 4.0. I have installed it and added follwing references to the project

Microsoft.Practices.EnterpriseLibrary.Configuration and Microsoft.Practices.EnterpriseLibrary.Data

But found following errors,

Error 1 Type 'DBCommandWrapper' is not defined

Error 2 'GetSqlStringCommandWrapper' is not a member of 'Microsoft.Practices.EnterpriseLibrary.Data.Database'

Dec 7, 2011 at 11:28 PM

By the sound of it you are using some code that was written to use Enterprise Library 1.

The class DbCommandWrapper and the method GetSqlStringCommandWrapper do not exist any longer in newer versions of the Data Access Application Block.

You will need to migrate the code:

DbCommandWrapper => DbCommand
GetSqlStringCommandWrapper = > GetSqlStringCommand

You may encounter other issues if you are using (very) old code.

If necessary, I would recommend you look at the Quickstarts (available with the source code) to see some working samples.

Further, I would recommend to upgrade to Enterprise Library 5.  If that isn't possible, then I would recommend an upgrade from 4.0 to 4.1 since 4.0 is actually a retired version.

Randy Levy
Enterprise Library support engineer

Dec 8, 2011 at 6:14 AM
Edited Dec 8, 2011 at 6:58 AM

Hi Randy,

Thanks for the quick reply.

Actually, my application is in .net 2.0 version and I am using visual studio 2003. Also its running now in production at client side. So its not possible to make all code changes in the application.

Can I get the information that when version 4.0 get retired. Coz some time before the code at dev side is working fine but now its showing the errors.

Will those errors get resolved after using the latest version of Enterprise Library?

I had tried with Enterprise Library 5.0 but its showing the same errors. Can you please tell me how to configure version 5.0 dlls with the application?


Dec 8, 2011 at 10:27 AM
Edited Dec 8, 2011 at 11:27 PM


It doesn't matter what version of .NET or Visual Studio you are using -- it's the version of Enterprise Library that does not support the classes/methods referenced in your code.

I'm not sure when Enterprise Library 4.0 was retired.  You can see it listed under retired versions at MSDN.  Version 4.1 is virtually the same as 4.0 with important bug fixes.  

Your errors will not be resolved unless you use Enterprise Library 1 because the classes/methods used in your code were removed from all releases since version 2. 

I'm not 100% sure what you mean by "configure version 5.0 dlls" but to use the Data Access Application Block you should reference (in Version 5):


Also, as far as I know you cannot build a .NET 2.0 application using Visual Studio 2003.

If you are truly targeting .NET 2.0 only, then according to the Enterprise Library requirements you should use Enterprise Library 3.1 (also retired) although the documentation says it requires Visual Studio 2005.

Randy Levy
Enterprise Library support engineer