I am using DAL and do not know how to sort the returned data table. The case throws an error, and intellisense does not offer me a lot of help:
Artwork.tblSpecificationsDataTable dsCommon = new Artwork.tblSpecificationsDataTable();
using (tblSpecificationsTableAdapter specAdapter = new tblSpecificationsTableAdapter())
{
specAdapter.FillByClientID(dsCommon, Master.loginData.loggedInUser.company.ID);
}
DataView v = dsCommon.DefaultView;
v.Sort = "category DESC";
dsCommon = (Artwork.tblSpecificationsDataTable)v.ToTable();
for (int i = 0; i < dsCommon.Count; i++)
{
test.Text += dsCommon[i].category + " " + dsCommon[i].FlatSize + "<br />";
}
Error without translation:
Error 3: It is not possible to implicitly convert the type 'System.Data.DataTable' to 'Artwork.tblSpecificationsDataTable. An explicit conversion exists (are you missing a listing?)
Edit
Apparently, I should sort in the query, which is fine, but I want the ORDER BY option for any of the ten fields to not create a dozen queries in the table adapter, how can I do this?
source
share