G
Guest
Hi
I'm creating a dataview "on the fly" in order to sort some data prior to writing out the information to a MS SQL table
I have used two methods in order to determine the sort order of the DataView. (I'm writing in C# with the v1.1.4322 of the .NET Framework, in Window2K server"). First of all, here are the two methods I have used in order to apply the sorting property to the DataView
1. Simply defining the sort order and colum
DataView dvReturn
string szSort = "DataRowID" + " ASC"
vReturn.Sort = szSort
2. Defining a primary key and then setting the default sort order
propert
/// when creating the datatable firs
DataTable dt
dt.PrimaryKey = new DataColumn[] {dt.Columns["DataRowID"]}
DataView dvFinal = new DataView(dt)
// then set the propert
dvFinal.ApplyDefaultSort = true
When I attempt to access the data from the DataView, the information is still listed as if it hasn't been sorted. Here is a sample of the code I have implemented in order to retrieve the sorted information (dvReturn would be the DataView I applied the sorting properties to
int iRowID = System.Convert.ToInt32(dvReturn[j]["DataRowID"].ToString())
int iEmpStatusID = System.Convert.ToInt32(dvReturn[j]["EmpStatusTypeID"].ToString())
Any help would be greatly appreciated, as it is not obvious to me what I am doing wrong. Thank you in advance
jwede
I'm creating a dataview "on the fly" in order to sort some data prior to writing out the information to a MS SQL table
I have used two methods in order to determine the sort order of the DataView. (I'm writing in C# with the v1.1.4322 of the .NET Framework, in Window2K server"). First of all, here are the two methods I have used in order to apply the sorting property to the DataView
1. Simply defining the sort order and colum
DataView dvReturn
string szSort = "DataRowID" + " ASC"
vReturn.Sort = szSort
2. Defining a primary key and then setting the default sort order
propert
/// when creating the datatable firs
DataTable dt
dt.PrimaryKey = new DataColumn[] {dt.Columns["DataRowID"]}
DataView dvFinal = new DataView(dt)
// then set the propert
dvFinal.ApplyDefaultSort = true
When I attempt to access the data from the DataView, the information is still listed as if it hasn't been sorted. Here is a sample of the code I have implemented in order to retrieve the sorted information (dvReturn would be the DataView I applied the sorting properties to
int iRowID = System.Convert.ToInt32(dvReturn[j]["DataRowID"].ToString())
int iEmpStatusID = System.Convert.ToInt32(dvReturn[j]["EmpStatusTypeID"].ToString())
Any help would be greatly appreciated, as it is not obvious to me what I am doing wrong. Thank you in advance
jwede