daab

C#: Is this the correct way to use the SqlDataReader for DAAB

一笑奈何 提交于 2019-12-24 10:48:37
问题 I have just started using the Data Access Application Block from microsoft. There are very few instructions on the correct way to use the library. Just wanted to know if this is the correct way to use the data reader. SqlDataReader reader = SqlHelper.ExecuteReader(config.ConnectionString, CommandType.Text, "select * from category"); List<string> a = new List<string>(); using (reader) { while (reader.Read()) { string t = reader.GetString(1); a.Add(t); } return a; } will everything get closed

DAAB, the best approach to use Database instances is

坚强是说给别人听的谎言 提交于 2019-12-22 08:25:32
问题 Guys, I am going to use Enterprise Library (4.1) and especially DAAB. Here is I have questions: What is the best approach and why: Every time when I need to run a DbCommand I create Database instance using DatabaseFactory.CreateDatabase(); I have a base class with instanced Database (using the same CreateDatabase() static method) and something like public property which returns the instanced database. How it is “heavy” or fast/slow to create an instance of Database class? What if I do it

Is the Microsoft Enterprise Library Data Access Application Block thread safe?

匆匆过客 提交于 2019-12-13 18:33:07
问题 I can't seem to find any documentation regarding thread safety... In particular - is the Database class (and subclasses) thread safe How would I find this out for myself? Are there references to thread safety for classes on the MSDN site? 回答1: Yes, instances of the Database class are thread-safe. However, objects created by it (such as SqlDataReader ) are not. 来源: https://stackoverflow.com/questions/2872023/is-the-microsoft-enterprise-library-data-access-application-block-thread-safe

The number of parameters does not match number of values for stored procedure

北慕城南 提交于 2019-12-12 12:28:55
问题 I am using Enterprise Library 5x DAAB to call an Oracle stored procedure with one input parameter and one output parameter. But it gives this error: The number of parameters does not match number of values for stored procedure My code is below: OracleDatabase _database; OracleConnection _connection; ... ... DbCommand insertCommand = _database.GetStoredProcCommand("spName"); insertCommand.Connection = _connection; _database.AddInParameter(insertCommand, "inParam", DbType.Int16); _database

Problem when trying to configure enterprise library 5.0 (Data Access Application Block)

允我心安 提交于 2019-12-08 14:59:49
问题 I am running into some problems while trying to get DAAB from Enterprise library 5.0 running. I have followed the steps as per the tutorial, but am getting errors... 1) Download / install enterprise library 2) Add references to the blocks I need (common / data) 3) Imports Imports Microsoft.Practices.EnterpriseLibrary.Common Imports Microsoft.Practices.EnterpriseLibrary.Data 4) Through the enterprise library config software. I open up the web.config from my site. I then click Blocks, then Add