Sorry, I am not good enough in expressing what I think. Now, I will try to express using example.
Consider the following query:
SELECT * FROM myDBTable1;
The above query is quite straight forward where it involves only one database table. When I bind the data (all column from myTable1) to DataGrid, and I set AllowSorting="true" and AllowPaging="true". With few lines of statement, both sorting and paging is working when I click on the DataGrid.
Now, the problem which I face. Looking at the query below again:
SELECT myDBTable1.*
FROM myDBTable1, myDBTable2
WHERE myDBTable1.ID = myDBTable2.ID
and
myDBTable1.Age = 24;
So, it is very obvious that the query above is involving two tables with a 'JOIN'. Once the data is fecthed from database and bind it to DataGrid, I will have problem in paging and sorting. It means that whenever I click on the column name on DataGrid with an attempt to sort the page, I will get some sort of error such like "ambiguous column" something like that. It is the same also if I click on the page number, error "index must >= 0" or something else.
I am looking for many solution, but still can't solve the problem. If you have "Beginning ASP.NET 1.1 with Visual C#.NET 2003", please look at page 258-261. I am following the example from there, with one different, where the book mentions only how to sort and paging DataGrid with a query which involves a single DB.
For sure I will share my coding, please let me know if you really want to look at it, I don't want to post it now because I am talking too much already. :)
Thanks for reply.
|