ADO.NET
. They are :.xsd file
) that contains DataSet structure information such as rows, columns, and tables. Data from the database is moved into a dataset and from the dataset to another component in the XML format.using System;
using System.Data.SqlClient;
using System.Data;
namespace DataSetDemo
{
public partial class DataSetExample : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
using (SqlConnection conn = new SqlConnection("data source=.; database=employee; integrated security=SSPI"))
{
SqlDataAdapter da = new SqlDataAdapter("Select * from employee", conn);
DataSet d = new DataSet();
da.Fill(d);
GridView1.DataSource = d;
GridView1.DataBind();
}
}
}
}​
Here, DataSet will be filled by DataAdapter that receives data from the employee table. This DataSet will be used to display the information received from the employee database.