M
Mark Rae
Hi,
Sorry about this, but I'm having a brainstorm here. I'm returning a DataSet
from a SQL Server database via a stored procedure, and need to sort the data
by a dynamically chosen set of fields. The DataSet is then used for various
tasks, but is *not* used as the DataSource of e.g. a DataGrid. Once I've got
my DataSet object populated with data, I'm doing the following:
DataView objDV = mobjDS.Tables[0].DefaultView;
if(cmbGroupBy.SelectedValue.Substring(1, 1) == "S")
{
objDV.Sort = "Level0Name, IssuerName, IssueDesc ASC";
}
Then I'm walking through the DataView as follows:
foreach(DataRow objDR in objDV.Table.Rows)
{
// processing
}
Problem is that the data isn't sorted. I''m clearly missing something
totally obvious... Does populating a DataView's Sort property not actually
sort the data until the DataView is bound to a control...?
Any assistance gratefully received.
Mark
Sorry about this, but I'm having a brainstorm here. I'm returning a DataSet
from a SQL Server database via a stored procedure, and need to sort the data
by a dynamically chosen set of fields. The DataSet is then used for various
tasks, but is *not* used as the DataSource of e.g. a DataGrid. Once I've got
my DataSet object populated with data, I'm doing the following:
DataView objDV = mobjDS.Tables[0].DefaultView;
if(cmbGroupBy.SelectedValue.Substring(1, 1) == "S")
{
objDV.Sort = "Level0Name, IssuerName, IssueDesc ASC";
}
Then I'm walking through the DataView as follows:
foreach(DataRow objDR in objDV.Table.Rows)
{
// processing
}
Problem is that the data isn't sorted. I''m clearly missing something
totally obvious... Does populating a DataView's Sort property not actually
sort the data until the DataView is bound to a control...?
Any assistance gratefully received.
Mark