Are you engaged in. NET applications? Program Data Access Code ? Do you think you are always writing the same data access code? Have you ever wrapped the data access code in the Helper function so that you can call stored procedures in one row? If so, Microsoft & reg; Data Access Application Block for. NET is designed for you.
Data Access Application Block encapsulates the best experience in accessing Microsoft SQL Server databases in terms of performance and resource management. You can easily use it as a constructor block in your. NET application, reducing the number of custom code that needs to be created, tested, and maintained from the page.
In particular, data access application block helps you:
Call stored procedures or SQL text commands.
Specify the Parameter Details.
Returns the sqldatareader, dataset, or xmlreader object.
For example, in an application that references data access application block, you can simply call a stored procedure in a line of code and generate a dataset, as shown below:
Dataset DS = sqlhelper. executedataset (
Connectionstring,
Commandtype. storedprocedure,
"Getproductsbycategory ",
New sqlparameter ("@ categoryid", categoryid ));
Note:
Application Block for. Net (Application Block for. net) is designed based on detailed research on successful. NET applications. It usesSource codeYou can use it as it is, or customize your own applications. This application block does not represent the future development direction of the Microsoft ADO. Net Library. The Microsoft ADO. Net Library is created to precisely control data access behavior in various use cases. In the future, ADO. NET may use different models to implement this scheme.
What content does the Data Access Application Block contain?
Provides source code of Data Access Application Block and Quick Start example applications. You can use these applications to test their functions. Data Access Application Block also includes comprehensive documents to help you use and understand the provided code.
Visual Studio. NET Project
Microsoft Visual Basic & reg ;. net and Microsoft Visual C # source code, as well as quick start sample client applications for each language, you can use these applications to test common solutions. This helps you better understand how Data Access Application Block works. You can also customize source code to meet your needs.
You can compile Visual Basic and C # Microsoft. applicationblocks. Data projects to generate an Assembly named Microsoft. applicationblocks. Data. dll. This Assembly includes a sqlhelper class (which includes the core functions used to execute database commands) and a sqlhelperparametercache class (which provides parameter discovery and caching functions ).
Document
The document of Data Access Application Block mainly includes the following:
Use Data Access Application Block to develop applications. This section includes a Quick Start example, which contains a variety of common usage scenarios to help you quickly and easily master the use of Data Access Application Block (Data Access Application Block.
Design and Implementation of Data Access Application Block. This section includes background design principles to help you gain an in-depth understanding of the design and implementation of the Data Access Application Block.
Deployment and operation. This section includes the installation information, including deployment and update options, and security-related information.
For more information, see. This section contains a comprehensive api reference, which details the classes and interfaces that constitute the Data Access Application Block.
System Requirements
To run Data Access Application Block, you must meet the following requirements:
Microsoft Windows & reg; 2000, Windows XP Professional
. NET Framework SDK (English) RTM version
RTM version of Visual Studio & reg;. Net (recommended but not required)
SQL Server 7.0 or later Database Server
Download and install Data Access Application Block
You can obtain a Windows installer file that contains the signed data access application block assembly and comprehensive documentation.
The installation process creates a Microsoft application blocks for. Net (Microsoft Application Block for. Net) submenu in the program menu. This sub-menu contains a data access sub-menu, including options for starting the document and options for starting the Data Access Application Block Visual Studio. NET solution.
Go to msdn downloads for download. Http://msdn.microsoft.com/downloads/default.asp? Url =/downloads/sample. asp? Url =/msdn-files/027/001/942/msdncompositedoc. xml
Use Data Access Application Block
The sqlhelper class provides a set of static methods that can be used to send many different types of commands to the SQL Server database.
the sqlhelperparametercache class provides command parameter caching to improve performance. This class is used internally by many execute methods (especially those that only run the stored procedure. The data access client can also directly use it to cache specific parameter sets of specific commands.