F
Fredrik Rodin
All,
I've been looking around for a solution to my problem for a couple of days
now.
In short, here's my situation:
1.
I'm getting a result from a component back as a datatable and I have no
option to sort the different columns during the call to the component.
Code-snippet:
Dim dTable As DataTable
Dim x As New MyComponent
'---between these two lines I add some parameters and properties
....x.blabla = ""
'---
2.
I then execute the component:
dTable = x.Execute()
So faar so good. No SQL invloved (only within the component).
Now comes the tricky part. I need to sort the result and display it.
However, I can't just use the .Sort in DataRow and get a 1-D array back. I
have properties in the component that I need to get back via an index. I've
already tried to re-build it using the array but it's simply not working.
So I thought I could create a 1-D array and then copy it to a second
DataTable. Something like this:
dTable.Execute()
Dim dRow As DataRow
dRow = dTable.Select(NOTHING, "COLUMN_NAME ASC, COLUMN_NAME2 DESC")
I now have a 1D array that contains my sorted data from the DataTAble
Now I would like to create a new DataTable from the 1D array.
Does anybody have any idea how to solve it?
Thanks in advance,
Fredrik
I've been looking around for a solution to my problem for a couple of days
now.
In short, here's my situation:
1.
I'm getting a result from a component back as a datatable and I have no
option to sort the different columns during the call to the component.
Code-snippet:
Dim dTable As DataTable
Dim x As New MyComponent
'---between these two lines I add some parameters and properties
....x.blabla = ""
'---
2.
I then execute the component:
dTable = x.Execute()
So faar so good. No SQL invloved (only within the component).
Now comes the tricky part. I need to sort the result and display it.
However, I can't just use the .Sort in DataRow and get a 1-D array back. I
have properties in the component that I need to get back via an index. I've
already tried to re-build it using the array but it's simply not working.
So I thought I could create a 1-D array and then copy it to a second
DataTable. Something like this:
dTable.Execute()
Dim dRow As DataRow
dRow = dTable.Select(NOTHING, "COLUMN_NAME ASC, COLUMN_NAME2 DESC")
I now have a 1D array that contains my sorted data from the DataTAble
Now I would like to create a new DataTable from the 1D array.
Does anybody have any idea how to solve it?
Thanks in advance,
Fredrik