Microsoft patterns & practices: The Enterprise Library in VB.NET
Microsoft patterns & practices provide scenario-specific recommendations illustrating how to design, develop, deploy, and operate architecturally sound applications for the Microsoft .NET platform.The following article covers details on the Data Access Application Block.
The text of this article is not in this database — only its details are. The old site it was published on is gone, but the Internet Archive kept a copy: Microsoft patterns & practices: The Enterprise Library in VB.NET

JosefPosted Jun 22, 2006, 5:45 PM EDT
I'm a bit confused about two lines of code and what they exactly do. Your example; 1 Private db As Database = DatabaseFactory.CreateDatabase("NorthwindDB_SQL") 'Prepare the SQL query. 2 Private sqlCommand As String = "Select EmployeeID, LastName + FirstName Name From Employees" 3 Private dbCommandWrapper As DBCommandWrapper = db.GetSqlStringCommandWrapper(sqlCommand) 4 Private dataReader As IDataReader=Nothing 'NOTE: The EmployeeDE represents a Data Entity class and the EmployeeDECollection class represents the collection for instances of the EmployeeDE class. 5 Private employeeCollection As EmployeeDECollection = New EmployeeDECollection() Try 6 dataReader = db.ExecuteReader(dbCommandWrapper) Line 3 gets the sqlCommand for that database object by passing the sqlcommand object into the database method called db.GetSqlStringCommandWrapper Why then in line 6 when you execute the command do you need to pass in the command wrapper. Since it contains the SQLcommand string which was already asociated with the current database in line 3 it appears as if you are just repeating yourself. Either line 3 and line 5 both associate the query to run with the db object.