DbCommand not available

Topics: Data Access Application Block
Oct 10, 2011 at 5:07 PM

Sorry for the newbie question but I'm tryig to get the DAAB setup in an existing site with Entlib v5.0.

I've made references to and see the .dll in my BIN for:
Microsoft.Practices.EnterpriseLibrary.Data
Microsoft.Practices.EnterpriseLibrary.Common
Microsoft.Practices.Unity
Microsoft.Practices.Unity.Interception
Microsoft.Practices.ServiceLocation

I also added "Imports Microsoft.Practices.EnterpriseLibrary.Data" to the top of my .vb page.

When I go to try to create the following line of code I get an error for the DbCommand saying "DbCommand is not defined" and it's not part of my intellisense. I do see IDbCommand though.


I'm not sure that I have the configuration file done correctly though but I wouldn't think I would get this error if the config file is not setup correctly.

In my DAL class file I'm inheriting from another class called BaseData that just has the creation of the database right now so I don't have to retype that each time. This is all thats in that class:

 Imports Microsoft.Practices.EnterpriseLibrary.Data


Public Class BaseData

Protected Shared db As Database
Shared Sub New()
db = DatabaseFactory.CreateDatabase()
End Sub

End
Class

Oct 24, 2011 at 7:53 AM

DbCommand is located in System.Data.Common.  You should just add:

Imports System.Data.Common

to your code.

--
Randy Levy
Enterprise Library support engineer
entlib.support@live.com>