Hi, i'm using VB.NET to interact with an Access database, and i have some questions about sorting.
When i physically go into the .accdb file and sort a table by column, and then read it in vb.net, it doesn't get read in the sorted order. It just get read in the regular order (the order the rows were created), why is that?
Can i sort the .accdb file (not the internal dataset) through visual basic? If not, how do i sort the internal dataset?
Sorting only sorts the data you're viewing. It has no effect on data storage. How data is stored in a database is basically irrelevant anyway. If you want data in a specific order when you query the database then you should be including an ORDER BY clause in that query.
Once you have populated a DataTable with the results of a query then, similarly, you can't really change how that data is stored in the DataTable. If you want to sort or filter the data then you do that through a DataView. Every DataTable already has an associated DataView, which you can access via the DefaultView property. When you bind the DataTable, the data displayed comes from the DefaultView. When binding data, bind the DataTable to a BindingSource and bind that to your control(s). You can then set the Sort and/or Filter properties and the data you see in the UI will be sorted and/or filtered.