Introduction

ADO stands for active data objects. It behaves as a mediator between the client-side and the server-side. As we know that one language does not understand the syntax of another language, there will be one translator who will behave as a mediator between both the languages as in the following figure:
Translator
Figure: Translator
The above figure has shown there are two persons. One person is an English speaker and another is a Hindi speaker so there is a translator who will help both the persons to communicate.

Connectionless oriented architecture

Connectionless oriented architecture contains:
Connection: Connection class uses to establish the connection between the front end and back end.
  1. SqlConnection con=new SqlConnection(“integratd security=true;initial catalog=Table Name;data source=.”);
DataAdapter: DataAdapter behaves as a mediator between data source and table.
  1. SqlDataAdapter da=new SqlDataAdapter(“Query which has to excute”,Connection object);
DataSet: DataSet contains the tables and relationships as in the following figure:
Connection less architecture
Figure: Connectionless architecture
DataAdapter does not have a feature of containing data so there is a dataset that contains table and relation after generating result set.
Syntax for DataSet is:
DataSet ds=new DataSet();
Da.Fill(ds,”X”);
The architecture of connectionless is as in the following figure:
Client-side interacts with server-side through ADO.NET because the front end application will not understand the syntax of back end application so there is ADO.NET which is a group of classes that contain Connection, Command, DataAdapter, and DataSet.
SSMS
Figure: Connectionless architecture
For performing work with connectionless architecture:
Create one web application now go to the .aspx page and write the following code for design:
  1. <%@PageLanguage="C#"AutoEventWireup="true"CodeBehind="DataList.aspx.cs"Inherits="IARE_Bus.DataList"%>
  2. <!DOCTYPE html>
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head runat="server">
  5. <title></title>
  6. </head>
  7. <body>
  8. <form id="form1" runat="server">
  9. <div>
  10. <asp:DataListIDasp:DataListID="DataList1"runat="server"OnSelectedIndexChanged="DataList1_SelectedIndexChanged">
  11. <HeaderTemplate>
  12. StartingPoint EndPoint Via Driver Bus_No
  13. </HeaderTemplate>
  14. <ItemTemplate>
  15. <%#Eval("StartingPoint") % >
  16. <%#Eval("EndingPoint") %>
  17. <%#Eval("Via") %>
  18. <%#Eval("Driver") %>
  19. <%#Eval("Bus_No") %>
  20. </ItemTemplate>
  21. </asp:DataList>
  22. </div>
  23. </form>
  24. </body>
  25. </html>
The design of the web application will be the following:
design
Now go to aspx.cs and write the following code:
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. using System.Data;
  8. using System.Data.SqlClient;
  9. namespace IARE_Bus {
  10. public partial class DataList: System.Web.UI.Page {
  11. SqlConnection con = newSqlConnection("integrated security=true;initial catalog=Iare;data source=.");
  12. SqlDataAdapter da;
  13. protected void Page_Load(object sender, EventArgs e) {
  14. string s = "select * from BusInfo";
  15. da = newSqlDataAdapter(s, con);
  16. DataSet ds = newDataSet();
  17. da.Fill(ds, "Bus");
  18. DataList1.DataSource = ds.Tables[0];
  19. DataList1.DataBind();
  20. }
  21. protected void DataList1_SelectedIndexChanged(object sender, EventArgs e) {
  22. }
  23. }
  24. }
Now run the application and check. In datalist all details of BusInfo table will display.
Read more articles on ADO.NET: