Shorting records in a data table

  • Thread starter Thread starter Vasilis X
  • Start date Start date
V

Vasilis X

Here is the question :

I have a data table, UnShorted, which has a data column EventTime (type :
date time) and a data column Values (type : single).

I want to create a table, Shorted, that will have all values of UnShorted
but they will be shorted by EventTime.
I try this :

dim Results as New DataRow( ) = UnShorted.Select ( "EventTime=EventTime" ,
"EventTime" )

Dim Shorted as New DataTable
Shorted=Unshorted.Clone( )

For each exRow as DataRow in Results

Shorted.ImportRow ( exRow )

Next exRow

Shorted.AcceptChanges


When I see the results, the records in data table Shorted are not shorted...

Why?

Thank you in advance,
Vasilis
 
Only the returned DataRow array from Select() method will be sorted. Row
order may not be preserved when importing them to another datatable.

-Siva

Here is the question :

I have a data table, UnShorted, which has a data column EventTime (type :
date time) and a data column Values (type : single).

I want to create a table, Shorted, that will have all values of UnShorted
but they will be shorted by EventTime.
I try this :

dim Results as New DataRow( ) = UnShorted.Select ( "EventTime=EventTime" ,
"EventTime" )

Dim Shorted as New DataTable
Shorted=Unshorted.Clone( )

For each exRow as DataRow in Results

Shorted.ImportRow ( exRow )

Next exRow

Shorted.AcceptChanges


When I see the results, the records in data table Shorted are not shorted...

Why?

Thank you in advance,
Vasilis
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top