in application -
here DataSet is filled with data by the
DataAdapter and then is set as a DataSource
for the DataList control.here i used MySql
database.
using System;
using MySql.Data;
using MySql.Data.MySqlClient;
namespace DataSet {
public partial class liststuds : System.Web.UI.Page
{
MySqlCommand cmd;
MySql.Data.MySqlClient.MySqlConnection conn;
MySqlDataReader reader;
protected void Page_Load(object sender, EventArgs e)
{
string connect = "Server=localhost;Database=MySqlDb;user
id=root;password=mridul;";//local db
string query = "SELECT * from adstuds order by state,breedname";
conn = new MySql.Data.MySqlClient.MySqlConnection(connect);
conn.Open();
MySqlDataAdapter adapter = new MySqlDataAdapter(query, conn);
DataSet data = new DataSet();
adapter.Fill(data);
StudListDataList.DataSource = data;
StudListDataList.DataBind();
}}}