asp.net.ph

Skip Navigation LinksHome > Data Access in Web Forms > ADO.NET Primer > Setting up ASP.NET Pages for Data Access

ADO.NET Primer


Setting up ASP.NET Pages for Data Access

The SQL Server™ Data Provider classes are accessed via the System.Data.SqlClient namespace. To use these classes, you need to include the namespace in the pages of your application that will use the provider.

To do so, use the @ Import directive at the top of the page, as in the following.

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
Master/Details Example Using Views
Run Sample | View Source

The OLEDB Data Provider classes are accessed via the System.Data.OleDb namespace. Likewise, to use these classes, you need to include the namespace at the top of the pages that will use the provider.

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
Binding a Parameterized Select Query
Run Sample | View Source

The System.Data namespace consists mostly of the classes that constitute the ADO.NET architecture that are common to both providers.

Together, these directives cover the needed set of interfaces for creating distributed, data-sharing .NET applications.

NOTE: Use of the SQL Server™ .NET Data Provider or OLE DB .NET Data Provider requires installation of Microsoft Data Access Components ( MDAC ) 2.8 or later on the Web server.

More ...
Back to top


© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note