Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
445
Sorting of data from Database
posted

Good day,

I was able to save the data to database successfully using databinding, I tried to fill up the task name with TaskName1, TaskName2, TaskName3, and so on, now when I retrieved it back, instead of TaskName1...2...3, it is now displaying in different order. How will I change it and use the original task order as were created.

Thanks

Parents
  • 53790
    Verified Answer
    posted

    Hello LSG,

    There are different approaches to solve this task. One possible solution could be :

    Usualy your column TaskId is uniqueidentifier in your database. Also this column is Primary Key, that`s why by default your Tasks are sorted by the task`s Guid. You could add a new column into your database (in my sample I call this addtional column - "ID") The dataType of this column could be Integer or DataTime and so on. If you choose to be Intger you could set "Identity Increment" and "Identity Seed" properties of our new column "ID". By this way each new Task will get new id depending of your creation order. We will use this column to sort our DataSet by this Id. If you are using TableAdapters into your scenario, you could modify your Select command (in the TableAdapter) using "Order By ID" column. Please take a look at the attached video file for more details.

    Please let me know if you have any questions.

    Regards

    video015.part001.rar
Reply Children