public partial class Default2 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { string ConnectionString = "server=(local);User id=sa;pwd=sa;database=Northwind"; string Sql = "select CustomerID,CompanyName,Country from Customers";
SqlConnection conn = new SqlConnection(ConnectionString); SqlDataAdapter adp = new SqlDataAdapter(Sql,conn);
DataTable table = new DataTable(); adp.Fill(table);
DataView dataView = new DataView(table, "Country='USA'","CompanyName Desc", DataViewRowState.CurrentRows);
GridView1.DataSource = dataView; GridView1.DataBind(); } }