Vyoms OneStopTesting.com - Testing EBooks, Tutorials, Articles, Jobs, Training Institutes etc.
OneStopGate.com - Gate EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.
OneStopMBA.com - MBA EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.
OneStopIAS.com - IAS EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.
OneStopSAP.com - SAP EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.
OneStopGRE.com - of GRE EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.
Bookmark and Share Rss Feeds

Introduction to ADO.NET 2.0 Data Source Controls | Articles | Recent Articles | News Article | Interesting Articles | Technology Articles | Articles On Education | Articles On Corporate | Company Articles | College Articles | Articles on Recession
Sponsored Ads
Hot Jobs
Fresher Jobs
Experienced Jobs
Government Jobs
Walkin Jobs
Placement Section
Company Profiles
Interview Questions
Placement Papers
Resources @ VYOMS
Companies In India
Consultants In India
Colleges In India
Exams In India
Latest Results
Notifications In India
Call Centers In India
Training Institutes In India
Job Communities In India
Courses In India
Jobs by Keyskills
Jobs by Functional Areas
Learn @ VYOMS
GATE Preparation
GRE Preparation
GMAT Preparation
IAS Preparation
SAP Preparation
Testing Preparation
MBA Preparation
News @ VYOMS
Freshers News
Job Articles
Latest News
India News Network
Interview Ebook
Get 30,000+ Interview Questions & Answers in an eBook.
Interview Success Kit - Get Success in Job Interviews
  • 30,000+ Interview Questions
  • Most Questions Answered
  • 5 FREE Bonuses
  • Free Upgrades

VYOMS TOP EMPLOYERS

Wipro Technologies
Tata Consultancy Services
Accenture
IBM
Satyam
Genpact
Cognizant Technologies

Home » Articles » Introduction to ADO.NET 2.0 Data Source Controls

Introduction to ADO.NET 2.0 Data Source Controls








Article Posted On Date : Thursday, March 22, 2012


Introduction to ADO.NET 2.0 Data Source Controls
Advertisements

Introduction

ASP.NET 2.0 provides new data source and data-bound server controls, which allow developers to write full-fledged data-driven applications without writing even a single line of code. This article is an introduction to these new data source controls. In my forthcoming articles, I will cover various data bound controls such as GridView, DetailsView, and FormView and how these controls use data-source controls to display data.

Microsoft Architects have proved in previous versions of ASP.NET that they are working hard to help programmers write less and less code, which is reused every where. For example, writing code for a database connection and setting up data access functionality (select, update, and delete) is very common functionality every programmer has to go through. Now ASP.NET 2.0 extends this functionality by providing built-in controls. These controls hardly require any code for common functionality.

Data source controls provides data access functionality including selecting, updating, deleting, and inserting data without writing any lines of code. As a developer, you can always access these controls' functionality programmatically. ASP.NET 2.0 has six data source controls and each of these data source controls is designed to work for a specific data source to provide better performance and flexibility. However there are more data source controls planned to release in next versions of ASP.NET. ASP.NET 2.0 has following data source controls

    SqlDataSource
    AccessDataSource
    ObjectDataSource
    DataSetDataSource
    XmlDataSource
    SiteMapDataSource

All of these data source controls are inherited from DataSourceControl class, which provides common functionality for all of these data source controls.

Data Source Controls

There are six data source controls and each of them is designed to work with a specific data source. The following table defined data source controls -
Data Source Control     Description     Data Source
SqlDataSource     Designed to work with SQL Server databases. It uses Sql Server .NET data provider internally. Sql Server .NET data provider classes are defined in the System.Data.SqlClient namespace.     SQL Server 2000 or later.
AccessDataSource     Designed to work with Microsoft Access. It uses OleDb data provider internally. OleDb data provider classes are defined in the System.Data.OleDb namespace.     Microsoft Access
ObjectDataSource     Designed to work with objects.     Object (usually classes provide a well-defined structure)
XmlDataSource     Designed to work with XML documents.     XML documents
SiteMapDataSource     Designed to work with SiteMap objects, which is a new concept in ASP.NET 2.0.     SiteMap
DataSetDataSource     Designed to work with DataSet objects.     DataSet

I am surprised not to see Oracle and ODBC data source controls, which are major requirements for non-Microsoft databases. I guess we can use these databases using traditional approach using Oracle and ODBC data providers.

Adding Data Source Controls using Visual Studio 2005

You can add SqlDataSource control by simply dragging control from Toolbox to a page.

When you drop SqlDataSource to a page, you will see Configure Data Source link.

Clicking this link launches Configure Data Source wizard, which allows you to configure a data source connection. See Figure 3. This wizard allows you to create a new connection or use existing connections by selecting from data connection drop down list.



Clicking New button of Configure Data Source wizard launches Connection Properties wizard, which allows you to create a new connection.

The next dialog of Configure Data Source wizard allows you to specify the variable name of the connection string.

The following dialog allows you to specify the SELECT statement. Here you can select a database table and its columns and add WHERE and ORDER BY clauses. See Figure 6.

Figure 6. Configure Select Statement dialog.

The next dialog tests the data.

Now this entire action adds the following code to the HTML file:

If you do not have Visual Studio, you can create SqlDataSource control in HTML by editing the HTML code. As you can see from this code, tag <asp:SqlDataSource> represents the SqlDataSource control and like other controls, you can set its parameters in HTML file. The above code sets SelectCommand and ConnectionString parameters of SqlDataSource control.

You can also set the controls parameters from Properties window. As you can see from Figure 8, you can set various properties of SqlDataSource including ConnectionString and SelectQuery.


If you InsertQuery property, it launches Command and Parameter Editor, where you can add and remove parameters. See Figure 9. From this dialog, you can also launch Query Builder, which allows you to create a SQL query.


Summary

ASP.NET version 2.0 provides new data source and data bound controls. In this article, I discussed data source controls and how to use them in Visual Studio 2005. In my forthcoming articles, I will be discussing rest of data source controls and how they can be used with data bound controls.






Sponsored Ads



Interview Questions
HR Interview Questions
Testing Interview Questions
SAP Interview Questions
Business Intelligence Interview Questions
Call Center Interview Questions

Databases

Clipper Interview Questions
DBA Interview Questions
Firebird Interview Questions
Hierarchical Interview Questions
Informix Interview Questions
Microsoft Access Interview Questions
MS SqlServer Interview Questions
MYSQL Interview Questions
Network Interview Questions
Object Relational Interview Questions
PL/SQL Interview Questions
PostgreSQL Interview Questions
Progress Interview Questions
Relational Interview Questions
SQL Interview Questions
SQL Server Interview Questions
Stored Procedures Interview Questions
Sybase Interview Questions
Teradata Interview Questions

Microsof Technologies

.Net Database Interview Questions
.Net Deployement Interview Questions
ADO.NET Interview Questions
ADO.NET 2.0 Interview Questions
Architecture Interview Questions
ASP Interview Questions
ASP.NET Interview Questions
ASP.NET 2.0 Interview Questions
C# Interview Questions
Csharp Interview Questions
DataGrid Interview Questions
DotNet Interview Questions
Microsoft Basics Interview Questions
Microsoft.NET Interview Questions
Microsoft.NET 2.0 Interview Questions
Share Point Interview Questions
Silverlight Interview Questions
VB.NET Interview Questions
VC++ Interview Questions
Visual Basic Interview Questions

Java / J2EE

Applet Interview Questions
Core Java Interview Questions
Eclipse Interview Questions
EJB Interview Questions
Hibernate Interview Questions
J2ME Interview Questions
J2SE Interview Questions
Java Interview Questions
Java Beans Interview Questions
Java Patterns Interview Questions
Java Security Interview Questions
Java Swing Interview Questions
JBOSS Interview Questions
JDBC Interview Questions
JMS Interview Questions
JSF Interview Questions
JSP Interview Questions
RMI Interview Questions
Servlet Interview Questions
Socket Programming Interview Questions
Springs Interview Questions
Struts Interview Questions
Web Sphere Interview Questions

Programming Languages

C Interview Questions
C++ Interview Questions
CGI Interview Questions
Delphi Interview Questions
Fortran Interview Questions
ILU Interview Questions
LISP Interview Questions
Pascal Interview Questions
Perl Interview Questions
PHP Interview Questions
Ruby Interview Questions
Signature Interview Questions
UML Interview Questions
VBA Interview Questions
Windows Interview Questions
Mainframe Interview Questions


Copyright © 2001-2024 Vyoms.com. All Rights Reserved. Home | About Us | Advertise With Vyoms.com | Jobs | Contact Us | Feedback | Link to Us | Privacy Policy | Terms & Conditions
Placement Papers | Get Your Free Website | IAS Preparation | C++ Interview Questions | C Interview Questions | Report a Bug | Romantic Shayari | CAT 2024

Fresher Jobs | Experienced Jobs | Government Jobs | Walkin Jobs | Company Profiles | Interview Questions | Placement Papers | Companies In India | Consultants In India | Colleges In India | Exams In India | Latest Results | Notifications In India | Call Centers In India | Training Institutes In India | Job Communities In India | Courses In India | Jobs by Keyskills | Jobs by Functional Areas

Testing Articles | Testing Books | Testing Certifications | Testing FAQs | Testing Downloads | Testing Interview Questions | Testing Jobs | Testing Training Institutes

Gate Articles | Gate Books | Gate Colleges | Gate Downloads | Gate Faqs | Gate Jobs | Gate News | Gate Sample Papers | Gate Training Institutes

MBA Articles | MBA Books | MBA Case Studies | MBA Business Schools | MBA Current Affairs | MBA Downloads | MBA Events | MBA Notifications | MBA FAQs | MBA Jobs
MBA Job Consultants | MBA News | MBA Results | MBA Courses | MBA Sample Papers | MBA Interview Questions | MBA Training Institutes

GRE Articles | GRE Books | GRE Colleges | GRE Downloads | GRE Events | GRE FAQs | GRE News | GRE Training Institutes | GRE Sample Papers

IAS Articles | IAS Books | IAS Current Affairs | IAS Downloads | IAS Events | IAS FAQs | IAS News | IAS Notifications | IAS UPSC Jobs | IAS Previous Question Papers
IAS Results | IAS Sample Papers | IAS Interview Questions | IAS Training Institutes | IAS Toppers Interview

SAP Articles | SAP Books | SAP Certifications | SAP Companies | SAP Study Materials | SAP Events | SAP FAQs | SAP Jobs | SAP Job Consultants
SAP Links | SAP News | SAP Sample Papers | SAP Interview Questions | SAP Training Institutes |


Copyright ©2001-2024 Vyoms.com, All Rights Reserved.
Disclaimer: VYOMS.com has taken all reasonable steps to ensure that information on this site is authentic. Applicants are advised to research bonafides of advertisers independently. VYOMS.com shall not have any responsibility in this regard.