Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sorting a dataset
Message
From
18/07/2013 11:35:08
 
 
To
18/07/2013 11:30:35
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01578641
Message ID:
01578775
Views:
33
>>Shouldn't this:
>>   ' Sort the dataset into the primary key
>>                oData.oDataView.Sort = "AI"
>> 
>>                ' For each record
>>                For lnCounter = 0 To oData.nCount - 1
>>                    loRow = oData.oRows(lnCounter)
>>                Next
be:
oData.oDataView.Sort = "AI"
>> 
>>                ' For each record
>>                For lnCounter = 0 To oData.oDataView.Count - 1
>>                    loRow = oData.oDataView.Item(lnCounter)
>>                Next
(Haven't checked the exact syntax). Once again: you are looping through the table in the first case - the DataView may as well not exist.
>
>The Data class always exposes the oDataView once a SQL select has been done.
>
>The oData.nCount is the same as oData.oDataView.Count as this is also initialized from the Data class once a SQL select command is executed.
>
>Now, as far as scanning the rows and assigning them to loRow, oRows is initialized like this at the Data class level:
>
>
>                ' If we have no record
>                If nCount = 0 Then
>                    oRows = Nothing
>                Else
>                    oDataView = oDataSet.Tables("Temp").DefaultView
>                    oRows = oDataSet.Tables("Temp").Rows()
>                End If
>
>
>So, the way oRows is initialized here, is it the same thing as oData.oDataView.Item?

I don't think I'm getting across (or I'm badly misunderstanding what you are doing) :-}

A DataView does NOT change the way a table is seen when it is accessed directly. It's a 'lens' through which to view the table. If you want the sort order of the DataView to be used then you must iterate the DataView NOT the table.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform