This example resembles ( http://manas6/aspnet.35/mm.PageAsyncTask2/ ) , where we used  Class PageAsyncTask of  System.Web.UI
Namespace,

Step 1: Create new website ( http://manas6/aspnet.35/mm.AdoConnected1/ )

Create a new Database

 

/* To prevent any potential data loss issues, you should review this script in detail before running it outside the context of the database designer.*/
BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
SET ARITHABORT ON
SET NUMERIC_ROUNDABORT OFF
SET CONCAT_NULL_YIELDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
COMMIT
BEGIN TRANSACTION
GO
ALTER TABLE dbo.Main ADD CONSTRAINT
PK_Main PRIMARY KEY CLUSTERED
(
sid
) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

GO
COMMIT
 

 

Add a class in App_Code

Add this line to Web.config

 <connectionStrings>
<add name="adoCnn" connectionString="Data Source=MANAS6\SQLEXPRESS;Initial Catalog=adoConnect1;Integrated Security=True" providerName="System.Data.SqlClient;" />
</connectionStrings>

As you start coding you will have prompt to make your selection

Now add this code

adoMain.cs

using System;
using System.Data;
using System.Web.Configuration;
using System.Data.SqlClient;
using System.Collections.Generic;
/// <summary>
/// Summary description for adMain
/// </summary>
public class adMain
{
static adMain()
{
_connectionString = WebConfigurationManager.ConnectionStrings["adoCnn"].ConnectionString;

}
public adMain()
{
//
// TODO: Add constructor logic here
// _connectionString = WebConfigurationManager.ConnectionStrings["addCnn"].ConnectionString;
//
}
private static readonly string _connectionString;
private string _sid;
private string _job;
private string _firstName;
private string _lastName;
private string _note;
public string sid
{
get { return _sid; }
set { _sid =value; }
}
public string Job
{
get { return _job; }
set { _job= value; }
}
public string FirstName
{
get { return _firstName; }
set { _firstName = value; }
}
public string LastName
{
get { return _lastName; }
set { _lastName = value; }
}
public string Note
{
get { return _note; }
set { _note = value; }
}
public List<adMain> GetAll()
{
List<adMain> results = new List<adMain>();
SqlConnection cnn = new SqlConnection(_connectionString);
SqlCommand cmd = new SqlCommand("SELECT * FROM Main", cnn);
using (cnn)
{
cnn.Open();
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
adMain adObj = new adMain();
//adObj.sid = (string)reader["sid"];
adObj.sid = Convert.ToString(reader["sid"]);
adObj.Job = (string)reader["Job"];
adObj.FirstName = (string)reader["FirstName"];
adObj.LastName = (string)reader["LastName"];
adObj.Note = (string)reader["Note"];
results.Add(adObj);
}

}
return results;
}
}

Code Default.aspx.cs

using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
adMain ad = new adMain();
L1.Text += ad.strTime;
}
}
 

Code: Default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Debug="true"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>mm.AdoConnectd 1: Connected ADO</title>
<style type="text/css">
#div1
{
position:absolute; background-color: #FFFFCC;
top: 15px; left: 10px; width: 350px;
}
body
{
background-color: Gray;
}
hr { width: 331px; }
</style>
</head>
<body>
<form id="form1" runat="server">
<div id="div1">
<asp:GridView ID="GV1" runat="server" DataSourceID="adoObj"
Caption="Ado Connected :DataReader" />
<hr align="left" width="10px" />
<asp:DetailsView ID="DV1" runat="server" DataSourceID="adoObj"
AllowPaging="True" Caption="Details View " Width="333px" />
<asp:ObjectDataSource ID="adoObj" TypeName="adMain" SelectMethod="GetAll" runat="server" />
</div>
</form>
</body>
</html>

The above code will set your loading default.aspx like this.

Behind the scene JavaScript plays it's trick and load the pages, and we are happy with C# coding.