Introduction The Microsoft.NET Framework consists of ADO.NET which enables developers to interact with the database. ADO.NET provides many rich features that can be used to retrieve and display data in a number of ways. Apart from the flexibility provided by ADO.NET, sometimes we find ourselves repeating the same code again and again. Consider that at some point in our application we need to pass some parameters and retrieve some information from the database. We can perform this task by writing 5-6 lines of code which is cool. But when later we need to pass parameters again we have to write those 5-6 lines again, which is not cool. For this reason Microsoft introduced the Data Access Application Block which can be used to perform common tasks with less code. Another good reason to use the Microsoft.NET Data Access Application Block is that it makes the application consistent, meaning that if different companies are using the Data Access Block then you will find the code more easier to understand. Installing.NET framework 3.5 on windows server 2012. Install Net Framework 3.5 SP1 Offline on Server 2012 R2. Download the ISO image for Windows Server. You can download the Microsoft.NET Data Access Application Block from. Download the Application Block and simply install it. Let's see how we can use it. Using the code Using the Microsoft.NET Data Access Application Block: In this article I have used the Microsoft.NET Data Access Application Block Version 2.0. Once you download and install the application block you need to refer it in your application. For this first you need to create the.dll file for the Microsoft.NET Data Access Application Block project. You can simply add the Data Access Application Block project in your current project and build the solution (this can also be performed using the command line tools). Once the solution is built, the.dll file is created under the bin directory. Delete the Data Access Project from your current project as you only need it to create the.dll. And now add a reference in your project which will refer to Microsoft.ApplicationBlock.Data. Once you have made the reference you are ready to use the Application Block in your project. Accessing data without Data Access Application Block: Let's first see how we can access data without using the Application Block so that we can compare the flexibility of both approaches. Below is a simple example that inserts two parameters into the database.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
September 2018
Categories |