Home > Net > The DataTable receive Sql returned data sequence is random? !
The DataTable receive Sql returned data sequence is random? !
Time:10-03
I have a select query, using storage process paging and sorting, execute SQL alone, is to get to the normal order of the data, and then in the code, after returning to the datatable, dt data in order to change, and change is random, only manually again to sort the datatable; The most strange is, only part of the data it is the case, and this part of the data with other types of data format of what are all the same, Does anyone encountered a similar situation, please answer!!!!!!
CodePudding user response:
What is "only a portion of the data it is the case," returned by the query data is the data table, as long as the SQL in order is correct, there will be no order,
CodePudding user response:
Very strange question, I'm not met,
CodePudding user response:
If your storage process in the "right" sorting, so will not happen this phenomenon, if there should be a logical cause other, you can spin off other logic, only a few words to write a simple engineering test of extracting database code
CodePudding user response:
Use the storage process paging and sorting So, if you do not pass the right sort parameters, the result is not obviously you expect Because the datatable can be manual sorting
CodePudding user response:
Must be somewhere in the sorting, serious look at your own stored procedure code
CodePudding user response:
Emphasize: Must have a definite order by SQL, the result is wants to order, without the order by that the order is not controllable,
CodePudding user response:
I had this kind of circumstance, you carefully check, which inevitably the reorder, If that is extracted from the database directly with ado.net, impossible to check a result, in the data to the program in another result Also add do not add the order by some so-called, even if you don't add, the database will also try to give you a fixed default rules
Unless it is not, the order by you in the test, other people also constantly change index, the probability is too rate