DAAB wrapper issues with MS Access
-
Hi, I am trying to write a wrapper for the DAAB in Ent Lib 2.0 since I have to use MS Access. As usual, I am facing hurdles right at the start. When I try to return the data reader from the wrapper class, I get the error "connection not initialised". I am using the Generic Database class. The relevant code is posted below: Dim objCommand As DbCommand Try Dim db As Microsoft.Practices.EnterpriseLibrary.Data.Database db = New GenericDatabase(ConnectionString, DBProvider) 'db.CreateConnection.Open() objCommand = db.GetSqlStringCommand(strSQL) error here --> Dim dr As IDataReader = objCommand.ExecuteReader() 'Dim dr As IDataReader = db.ExecuteReader(strSQL) Return dr I get the error: Connection property has not been initialised. I have tried with opening the connection, getting the datareader directly etc., but still the same error. And yes, the connectionstring is correct. The provider I am using is OleDB.OledBFactory.Instance. Any help/guidance on this is really appreciated. Shreekar
-
Hi, I am trying to write a wrapper for the DAAB in Ent Lib 2.0 since I have to use MS Access. As usual, I am facing hurdles right at the start. When I try to return the data reader from the wrapper class, I get the error "connection not initialised". I am using the Generic Database class. The relevant code is posted below: Dim objCommand As DbCommand Try Dim db As Microsoft.Practices.EnterpriseLibrary.Data.Database db = New GenericDatabase(ConnectionString, DBProvider) 'db.CreateConnection.Open() objCommand = db.GetSqlStringCommand(strSQL) error here --> Dim dr As IDataReader = objCommand.ExecuteReader() 'Dim dr As IDataReader = db.ExecuteReader(strSQL) Return dr I get the error: Connection property has not been initialised. I have tried with opening the connection, getting the datareader directly etc., but still the same error. And yes, the connectionstring is correct. The provider I am using is OleDB.OledBFactory.Instance. Any help/guidance on this is really appreciated. Shreekar
shreekar wrote:
Dim dr As IDataReader = db.ExecuteReader(strSQL)
Try
Dim dr As IDataReader = db.ExecuteReader(objCommand)
Michael CP Blog [^] Development Blog [^]
-
shreekar wrote:
Dim dr As IDataReader = db.ExecuteReader(strSQL)
Try
Dim dr As IDataReader = db.ExecuteReader(objCommand)
Michael CP Blog [^] Development Blog [^]