Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sorting from a datatable
Message
From
27/10/2006 09:31:34
 
 
To
26/10/2006 17:17:59
General information
Forum:
ASP.NET
Category:
Databases
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01164032
Message ID:
01164980
Views:
12
Michel,

If I recall from your initial post, you just want the resulting table to be sorted, correct? As I indicated in my reply to you, all you need to do is sort the DefaultView. Then the DataTable resulting from the .ToTable() method will also be sorted.
                toDataSet.Tables(tcTable).DefaultView.Sort = tcColumn
                oDataTable = toDataSet.Tables(tcTable).DefaultView.ToTable(tcTable, True, lcColumnArray.ToCharArray)
~~Bonnie



>>The defaultview has a sort property...
>>
>>MyDataSet.Tables[0].DefaultView.Sort = "mysortcolumn";
>>
>>let me know if that works...
>
>After having looked into it, here is how I create the datatable:
>
>
>        ' Take distinct values from a column and return them as datatable
>        ' expO1 Dataset
>        ' expC1 Table
>        '       Optional
>        '       Default is Temp
>        ' expC2 Column name
>        Public Function DistinctValue(ByVal toDataSet As DataSet, _
>         Optional ByVal tcTable As String = "Temp", _
>         Optional ByVal tcColumn As String = "") As Boolean
>            Dim lcColumnArray As String = ""
>            lcColumnArray = tcColumn
>            Try
>                oDataTable = toDataSet.Tables(tcTable).DefaultView.ToTable(tcTable, True, lcColumnArray.ToCharArray)
>            Catch loError As Exception
>                DataError(loError, oApp.Debug(loError.Message))
>                Return False
>            End Try
>            Return True
>        End Function
>
>
>So, at this point, I have a datatable. I am not sure how to move from here to a dataset in order to execute your command.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform