Hi Bill,
First of all, I would like to confirm my understanding of your issue.
From your description, I understand that you wants to Sort the underlying
datatable of a datagrid in another order and you find that when you change
the datatable's defaultview the data in the datagrid will not be sorted.
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.
I can not reproduce the problem.
Here is my test code.
DataSet ds = new DataSet("TestDS");
private void Form1_Load(object sender, System.EventArgs e)
{
System.Data.OleDb.OleDbConnection cn = new
System.Data.OleDb.OleDbConnection("<ConnectString> ");
cn.Open();
System.Data.OleDb.OleDbCommand cmd = new
System.Data.OleDb.OleDbCommand("Select * from Employees");
cmd.Connection=cn;
System.Data.OleDb.OleDbDataAdapter da = new
System.Data.OleDb.OleDbDataAdapter();
da.SelectCommand=cmd;
da.Fill(ds);
this.oleDbDataAdapter1.Fill(this.dataSet11);
this.dataGrid1.DataSource= ds.Tables[0];
}
private void button1_Click(object sender, System.EventArgs e)
{
this.ds.Tables[0].DefaultView.Sort = "City DESC";
}
You may try my code and let me know the result, if you still have any
concern can you post your code here, so that we can do further
troubleshooting.
Best regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.