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 9 2415
Jwedel:
If you call ApplyDefaultSort after the sort, it will undo the sort you
specified and use the original one. What exactly is that last reference
doing? It looks like you are just referencing one row, so whatever J is
will determine the sort order. Nonetheless, if you just use Sort like you
did in the first one, regardless of primary key, you'll sort on that field.
"jwedel_stolo" <an*******@discussions.microsoft.com> wrote in message
news:F0**********************************@microsof t.com... 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 column DataView dvReturn;
string szSort = "DataRowID" + " ASC"; vReturn.Sort = szSort;
2. Defining a primary key and then setting
the default sort order property /// when creating the datatable first DataTable dt; dt.PrimaryKey = new DataColumn[]
{dt.Columns["DataRowID"]}; DataView dvFinal = new DataView(dt);
// then set the property 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. jwedel
Jwedel:
If you call ApplyDefaultSort after the sort, it will undo the sort you
specified and use the original one. What exactly is that last reference
doing? It looks like you are just referencing one row, so whatever J is
will determine the sort order. Nonetheless, if you just use Sort like you
did in the first one, regardless of primary key, you'll sort on that field.
"jwedel_stolo" <an*******@discussions.microsoft.com> wrote in message
news:F0**********************************@microsof t.com... 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 column DataView dvReturn;
string szSort = "DataRowID" + " ASC"; vReturn.Sort = szSort;
2. Defining a primary key and then setting
the default sort order property /// when creating the datatable first DataTable dt; dt.PrimaryKey = new DataColumn[]
{dt.Columns["DataRowID"]}; DataView dvFinal = new DataView(dt);
// then set the property 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. jwedel
William
1. Apologies for the ambiguity.... I have not used the two sorting mechanisms concurrently. I am aware if you set the sort order initially (as in item #1) and then set the "ApplyDefaultSort" property to "true", that it will overwrite the inital sort ou specificed.... (it is clearly stated in the documentation)... but thank you anyway
2. The last reference (int iRowID = System.Convert.ToInt32(dvReturn[j]["DataRowID"].ToString()) is referencing a single row, where "j" is simply an iterator within a "for" loop. I am copying the contents of each row within the DataView back to an ArrayList.
I am interested in your comment re: "j" though... how will "j" determine my sort order... ?? Please respond at your convenience, and thank you for the assistance
Regards
jwede
----- William Ryan eMVP wrote: ----
Jwedel
If you call ApplyDefaultSort after the sort, it will undo the sort yo
specified and use the original one. What exactly is that last referenc
doing? It looks like you are just referencing one row, so whatever J i
will determine the sort order. Nonetheless, if you just use Sort like yo
did in the first one, regardless of primary key, you'll sort on that field
"jwedel_stolo" <an*******@discussions.microsoft.com> wrote in messag
news:F0**********************************@microsof t.com.. Hi I'm creating a dataview "on the fly" in order to sort some data prio
to writing out the information to a MS SQL table I have used two methods in order to determine the sort order of th
DataView. (I'm writing in C# with the v1.1.4322 of the .NET Framework, i
Window2K server"). First of all, here are the two methods I have used i
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 settin
the default sort orde 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 informatio
is still listed as if it hasn't been sorted. Here is a sample of the code
have implemented in order to retrieve the sorted information (dvReturn woul
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 wha
I am doing wrong. Thank you in advance jwede>
William
1. Apologies for the ambiguity.... I have not used the two sorting mechanisms concurrently. I am aware if you set the sort order initially (as in item #1) and then set the "ApplyDefaultSort" property to "true", that it will overwrite the inital sort ou specificed.... (it is clearly stated in the documentation)... but thank you anyway
2. The last reference (int iRowID = System.Convert.ToInt32(dvReturn[j]["DataRowID"].ToString()) is referencing a single row, where "j" is simply an iterator within a "for" loop. I am copying the contents of each row within the DataView back to an ArrayList.
I am interested in your comment re: "j" though... how will "j" determine my sort order... ?? Please respond at your convenience, and thank you for the assistance
Regards
jwede
----- William Ryan eMVP wrote: ----
Jwedel
If you call ApplyDefaultSort after the sort, it will undo the sort yo
specified and use the original one. What exactly is that last referenc
doing? It looks like you are just referencing one row, so whatever J i
will determine the sort order. Nonetheless, if you just use Sort like yo
did in the first one, regardless of primary key, you'll sort on that field
"jwedel_stolo" <an*******@discussions.microsoft.com> wrote in messag
news:F0**********************************@microsof t.com.. Hi I'm creating a dataview "on the fly" in order to sort some data prio
to writing out the information to a MS SQL table I have used two methods in order to determine the sort order of th
DataView. (I'm writing in C# with the v1.1.4322 of the .NET Framework, i
Window2K server"). First of all, here are the two methods I have used i
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 settin
the default sort orde 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 informatio
is still listed as if it hasn't been sorted. Here is a sample of the code
have implemented in order to retrieve the sorted information (dvReturn woul
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 wha
I am doing wrong. Thank you in advance jwede>
"jwedel_stolo" <an*******@discussions.microsoft.com> wrote in message
news:09**********************************@microsof t.com... William, 1. Apologies for the ambiguity.... I have not used the two sorting
mechanisms concurrently. I am aware if you set the sort order initially (as
in item #1) and then set the "ApplyDefaultSort" property to "true", that it
will overwrite the inital sort ou specificed.... (it is clearly stated in
the documentation)... but thank you anyway.
I'm lost then, how does it fit in here or is just extraneous code? When
does it get applied b/c the timing of the events with this could easily
explain the problem. 2. The last reference (int iRowID =
System.Convert.ToInt32(dvReturn[j]["DataRowID"].ToString()) is referencing a
single row, where "j" is simply an iterator within a "for" loop. I am
copying the contents of each row within the DataView back to an ArrayList..
We need to determine where exactly the problem is. So go ahead and grab the
last value of the datatable in Column0 for instance and see what it is.
Then apply the sort and reference that row within the View! Only the view
is sorted not the datatable. An easy way to do this is make a test grid and
bind to it. Have a button that changes the sort field. Click on it a few
times and make sure it's sorting correctly. You'll have a visual cue if you
use a grid. I've never seen this not work and I use it constantly so I
suspect it may appear that it's not sorting but it's probably the reference
to the row. I am interested in your comment re: "j" though... how will "j"
determine my sort order... ?? Please respond at your convenience, and thank
you for the assistance.
Whatever j will pass that row regardless of how it's sorted. Basically, if
J is 200 and there are 200 rows, you'll get the last row, but after a sort,
if the same row is now position 15, it's only going to be 'correct' when j
is 15. Regards, jwedel ----- William Ryan eMVP wrote: -----
Jwedel:
If you call ApplyDefaultSort after the sort, it will undo the sort
you specified and use the original one. What exactly is that last
reference doing? It looks like you are just referencing one row, so whatever J
is will determine the sort order. Nonetheless, if you just use Sort like
you did in the first one, regardless of primary key, you'll sort on that
field. "jwedel_stolo" <an*******@discussions.microsoft.com> wrote in message news:F0**********************************@microsof t.com... > 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 column > DataView dvReturn; >> string szSort = "DataRowID" + " ASC"; > vReturn.Sort = szSort; >> 2. Defining a primary key and then
setting the default sort order > property > /// when creating the datatable
first > DataTable dt; > dt.PrimaryKey = new DataColumn[] {dt.Columns["DataRowID"]}; > DataView dvFinal = new DataView(dt); >> // then set the property > 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. >> jwedel >>>>>
"jwedel_stolo" <an*******@discussions.microsoft.com> wrote in message
news:09**********************************@microsof t.com... William, 1. Apologies for the ambiguity.... I have not used the two sorting
mechanisms concurrently. I am aware if you set the sort order initially (as
in item #1) and then set the "ApplyDefaultSort" property to "true", that it
will overwrite the inital sort ou specificed.... (it is clearly stated in
the documentation)... but thank you anyway.
I'm lost then, how does it fit in here or is just extraneous code? When
does it get applied b/c the timing of the events with this could easily
explain the problem. 2. The last reference (int iRowID =
System.Convert.ToInt32(dvReturn[j]["DataRowID"].ToString()) is referencing a
single row, where "j" is simply an iterator within a "for" loop. I am
copying the contents of each row within the DataView back to an ArrayList..
We need to determine where exactly the problem is. So go ahead and grab the
last value of the datatable in Column0 for instance and see what it is.
Then apply the sort and reference that row within the View! Only the view
is sorted not the datatable. An easy way to do this is make a test grid and
bind to it. Have a button that changes the sort field. Click on it a few
times and make sure it's sorting correctly. You'll have a visual cue if you
use a grid. I've never seen this not work and I use it constantly so I
suspect it may appear that it's not sorting but it's probably the reference
to the row. I am interested in your comment re: "j" though... how will "j"
determine my sort order... ?? Please respond at your convenience, and thank
you for the assistance.
Whatever j will pass that row regardless of how it's sorted. Basically, if
J is 200 and there are 200 rows, you'll get the last row, but after a sort,
if the same row is now position 15, it's only going to be 'correct' when j
is 15. Regards, jwedel ----- William Ryan eMVP wrote: -----
Jwedel:
If you call ApplyDefaultSort after the sort, it will undo the sort
you specified and use the original one. What exactly is that last
reference doing? It looks like you are just referencing one row, so whatever J
is will determine the sort order. Nonetheless, if you just use Sort like
you did in the first one, regardless of primary key, you'll sort on that
field. "jwedel_stolo" <an*******@discussions.microsoft.com> wrote in message news:F0**********************************@microsof t.com... > 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 column > DataView dvReturn; >> string szSort = "DataRowID" + " ASC"; > vReturn.Sort = szSort; >> 2. Defining a primary key and then
setting the default sort order > property > /// when creating the datatable
first > DataTable dt; > dt.PrimaryKey = new DataColumn[] {dt.Columns["DataRowID"]}; > DataView dvFinal = new DataView(dt); >> // then set the property > 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. >> jwedel >>>>>
Willia
Thanks for all your help. As it turns out, the implementation of the sort and the subsequent accessing of the data is correct. I'm sorting on an integer value. Therefore, if I had an array of integers such as 1,2,13,3... the subsequent sort order will be: 1,13,2,3... I had to preceed the values with a '0' in order to obtain the correct sort order I desired....
(ie; 01, 02, 03, 13... is the sort order I requried).... apologies for wasting your time
regards
jwede
...
Thanks in advance
----- William Ryan eMVP wrote: ----
"jwedel_stolo" <an*******@discussions.microsoft.com> wrote in messag
news:09**********************************@microsof t.com.. William 1. Apologies for the ambiguity.... I have not used the two sortin
mechanisms concurrently. I am aware if you set the sort order initially (a
in item #1) and then set the "ApplyDefaultSort" property to "true", that i
will overwrite the inital sort ou specificed.... (it is clearly stated i
the documentation)... but thank you anyway
I'm lost then, how does it fit in here or is just extraneous code? Whe
does it get applied b/c the timing of the events with this could easil
explain the problem 2. The last reference (int iRowID
System.Convert.ToInt32(dvReturn[j]["DataRowID"].ToString()) is referencing
single row, where "j" is simply an iterator within a "for" loop. I a
copying the contents of each row within the DataView back to an ArrayList.
We need to determine where exactly the problem is. So go ahead and grab th
last value of the datatable in Column0 for instance and see what it is
Then apply the sort and reference that row within the View! Only the vie
is sorted not the datatable. An easy way to do this is make a test grid an
bind to it. Have a button that changes the sort field. Click on it a fe
times and make sure it's sorting correctly. You'll have a visual cue if yo
use a grid. I've never seen this not work and I use it constantly so
suspect it may appear that it's not sorting but it's probably the referenc
to the row I am interested in your comment re: "j" though... how will "j
determine my sort order... ?? Please respond at your convenience, and than
you for the assistance
Whatever j will pass that row regardless of how it's sorted. Basically, i
J is 200 and there are 200 rows, you'll get the last row, but after a sort
if the same row is now position 15, it's only going to be 'correct' when
is 15 Regards jwede ----- William Ryan eMVP wrote: ----
Jwedel If you call ApplyDefaultSort after the sort, it will undo the sor
yo specified and use the original one. What exactly is that las
referenc doing? It looks like you are just referencing one row, so whatever
i will determine the sort order. Nonetheless, if you just use Sort lik
yo did in the first one, regardless of primary key, you'll sort on tha
field "jwedel_stolo" <an*******@discussions.microsoft.com> wrote in messag news:F0**********************************@microsof t.com.. Hi I'm creating a dataview "on the fly" in order to sort some dat
prio to writing out the information to a MS SQL table I have used two methods in order to determine the sort order of th DataView. (I'm writing in C# with the v1.1.4322 of the .NE
Framework, i Window2K server"). First of all, here are the two methods I have use
i order to apply the sorting property to the DataView 1. Simply defining the sort orde
and colum DataView dvReturn string szSort = "DataRowID" + " ASC" vReturn.Sort = szSort 2. Defining a primary key and then
setting the default sort order property /// when creating the datatable
first DataTable dt; dt.PrimaryKey = new DataColumn[] {dt.Columns["DataRowID"]}; DataView dvFinal = new DataView(dt); // then set the property 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. jwedel >>
Willia
Thanks for all your help. As it turns out, the implementation of the sort and the subsequent accessing of the data is correct. I'm sorting on an integer value. Therefore, if I had an array of integers such as 1,2,13,3... the subsequent sort order will be: 1,13,2,3... I had to preceed the values with a '0' in order to obtain the correct sort order I desired....
(ie; 01, 02, 03, 13... is the sort order I requried).... apologies for wasting your time
regards
jwede
...
Thanks in advance
----- William Ryan eMVP wrote: ----
"jwedel_stolo" <an*******@discussions.microsoft.com> wrote in messag
news:09**********************************@microsof t.com.. William 1. Apologies for the ambiguity.... I have not used the two sortin
mechanisms concurrently. I am aware if you set the sort order initially (a
in item #1) and then set the "ApplyDefaultSort" property to "true", that i
will overwrite the inital sort ou specificed.... (it is clearly stated i
the documentation)... but thank you anyway
I'm lost then, how does it fit in here or is just extraneous code? Whe
does it get applied b/c the timing of the events with this could easil
explain the problem 2. The last reference (int iRowID
System.Convert.ToInt32(dvReturn[j]["DataRowID"].ToString()) is referencing
single row, where "j" is simply an iterator within a "for" loop. I a
copying the contents of each row within the DataView back to an ArrayList.
We need to determine where exactly the problem is. So go ahead and grab th
last value of the datatable in Column0 for instance and see what it is
Then apply the sort and reference that row within the View! Only the vie
is sorted not the datatable. An easy way to do this is make a test grid an
bind to it. Have a button that changes the sort field. Click on it a fe
times and make sure it's sorting correctly. You'll have a visual cue if yo
use a grid. I've never seen this not work and I use it constantly so
suspect it may appear that it's not sorting but it's probably the referenc
to the row I am interested in your comment re: "j" though... how will "j
determine my sort order... ?? Please respond at your convenience, and than
you for the assistance
Whatever j will pass that row regardless of how it's sorted. Basically, i
J is 200 and there are 200 rows, you'll get the last row, but after a sort
if the same row is now position 15, it's only going to be 'correct' when
is 15 Regards jwede ----- William Ryan eMVP wrote: ----
Jwedel If you call ApplyDefaultSort after the sort, it will undo the sor
yo specified and use the original one. What exactly is that las
referenc doing? It looks like you are just referencing one row, so whatever
i will determine the sort order. Nonetheless, if you just use Sort lik
yo did in the first one, regardless of primary key, you'll sort on tha
field "jwedel_stolo" <an*******@discussions.microsoft.com> wrote in messag news:F0**********************************@microsof t.com.. Hi I'm creating a dataview "on the fly" in order to sort some dat
prio to writing out the information to a MS SQL table I have used two methods in order to determine the sort order of th DataView. (I'm writing in C# with the v1.1.4322 of the .NE
Framework, i Window2K server"). First of all, here are the two methods I have use
i order to apply the sorting property to the DataView 1. Simply defining the sort orde
and colum DataView dvReturn string szSort = "DataRowID" + " ASC" vReturn.Sort = szSort 2. Defining a primary key and then
setting the default sort order property /// when creating the datatable
first DataTable dt; dt.PrimaryKey = new DataColumn[] {dt.Columns["DataRowID"]}; DataView dvFinal = new DataView(dt); // then set the property 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. jwedel >>
Not a waste of time at all. But that seems weird, what's the datatype of
the column, Int? It looks like a string.
"jwedel_stolo" <an*******@discussions.microsoft.com> wrote in message
news:03**********************************@microsof t.com... William Thanks for all your help. As it turns out, the implementation of the
sort and the subsequent accessing of the data is correct. I'm sorting on an
integer value. Therefore, if I had an array of integers such as 1,2,13,3...
the subsequent sort order will be: 1,13,2,3... I had to preceed the values
with a '0' in order to obtain the correct sort order I desired..... (ie; 01, 02, 03, 13... is the sort order I requried).... apologies for
wasting your time. regards, jwedel
... Thanks in advance.
----- William Ryan eMVP wrote: ----- "jwedel_stolo" <an*******@discussions.microsoft.com> wrote in message news:09**********************************@microsof t.com... > William, > 1. Apologies for the ambiguity.... I have not used the two
sorting mechanisms concurrently. I am aware if you set the sort order
initially (as in item #1) and then set the "ApplyDefaultSort" property to "true",
that it will overwrite the inital sort ou specificed.... (it is clearly
stated in the documentation)... but thank you anyway.
I'm lost then, how does it fit in here or is just extraneous code?
When does it get applied b/c the timing of the events with this could
easily explain the problem. >> 2. The last reference (int iRowID = System.Convert.ToInt32(dvReturn[j]["DataRowID"].ToString()) is
referencing a single row, where "j" is simply an iterator within a "for" loop. I am copying the contents of each row within the DataView back to an
ArrayList.. We need to determine where exactly the problem is. So go ahead and
grab the last value of the datatable in Column0 for instance and see what it
is. Then apply the sort and reference that row within the View! Only the
view is sorted not the datatable. An easy way to do this is make a test
grid and bind to it. Have a button that changes the sort field. Click on it a
few times and make sure it's sorting correctly. You'll have a visual cue
if you use a grid. I've never seen this not work and I use it constantly so
I suspect it may appear that it's not sorting but it's probably the
reference to the row. >> I am interested in your comment re: "j" though... how will "j" determine my sort order... ?? Please respond at your convenience, and
thank you for the assistance.
Whatever j will pass that row regardless of how it's sorted.
Basically, if J is 200 and there are 200 rows, you'll get the last row, but after a
sort, if the same row is now position 15, it's only going to be 'correct'
when j is 15. >> Regards, > jwedel >>>> ----- William Ryan eMVP wrote: ----- >> Jwedel: >> If you call ApplyDefaultSort after the sort, it will undo the
sort you > specified and use the original one. What exactly is that last reference > doing? It looks like you are just referencing one row, so
whatever J is > will determine the sort order. Nonetheless, if you just use
Sort like you > did in the first one, regardless of primary key, you'll sort
on that field. > "jwedel_stolo" <an*******@discussions.microsoft.com> wrote in
message > news:F0**********************************@microsof t.com... >> 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 column >> DataView dvReturn; >>> string szSort = "DataRowID" + " ASC"; >> vReturn.Sort = szSort; >>> 2. Defining a primary key and then setting > the default sort order >> property >> /// when creating the datatable first >> DataTable dt; >> dt.PrimaryKey = new DataColumn[] > {dt.Columns["DataRowID"]}; >> DataView dvFinal = new DataView(dt); >>> // then set the property >> 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. >>> jwedel >>>>>> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: DraguVaso |
last post by:
Hi,
I have 2 comboboxes, both bound to a different DataView, but thoe DataViews
are bound to 1 DataTable in 1 DataSet.
Like this:
Dim dvwList2 As New DataView
dvwList2 =...
|
by: Raymond Lewallen |
last post by:
I have a dataview in which the sort property will not sort the dataview.
Here's is a simple scenario similar to what I am doing:
Class Foo
Private Function Retrieve() As DataView
' Returns a...
|
by: TaeHo Yoo |
last post by:
Hi all,
After sorting and grouping data using a dataview, then how to transfer
the changed datatable in the dataview to a datatable in C#?
Cheers
|
by: grolms |
last post by:
I must recreated dataview . I am in the designer insert
dataview set datasource ... And I set before DataBind
datasource on the dataview ... How I recreated dataview.
I have dataview in class...
|
by: jwedel_stolo |
last post by:
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...
|
by: Nick |
last post by:
I have a code that returns data in IList. My webGrid doesn't allow me to
sort with IList returned, it say it only suports DataView, DataTable and
DataSet, not IEnumerable. I don't know how to...
|
by: Pravin Pujari |
last post by:
Hi All,
I am using .net framework 1.1 and c#. I have one problem regarding dataview.
I have one dataview to which sorting may be applied or may not be applied. I have one UI component where I...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
|
by: Arjunsri |
last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
|
by: WisdomUfot |
last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
|
by: Matthew3360 |
last post by:
Hi,
I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
|
by: Carina712 |
last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
|
by: Rahul1995seven |
last post by:
Introduction:
In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
|
by: Johno34 |
last post by:
I have this click event on my form. It speaks to a Datasheet Subform
Private Sub Command260_Click()
Dim r As DAO.Recordset
Set r = Form_frmABCD.Form.RecordsetClone
r.MoveFirst
Do
If...
|
by: ezappsrUS |
last post by:
Hi,
I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
|
by: jack2019x |
last post by:
hello, Is there code or static lib for hook swapchain present?
I wanna hook dxgi swapchain present for dx11 and dx9.
| |