Answer: DataView provides us with the
Sort property
example:
private void button1_Click(object sender, EventArgs e)
{
DataView dv = new DataView(ds.Tables["demo"]);
dv.Sort = "productname";
dataGridView1.DataSource = dv;
}
}
Note:
ds is the object reference of the DataSet
"demo" is the DataTable an stores a copy of the poducts table from the
Northwind database.
This example will sort the DataGridView on the basis of productname column.
first we have to connect using SqlConnection and use SqlDataAapter for the
query
|
Alert Moderator