0

The question here is about using nested GridViews or to "pre-assemble" the data from two tables using an SQL UNION in order to display it with a single GridView so that it appears as shown on the image below.

I am working on an ASP.Net project for which I am developing a form to match data between tables in two databases (Well the tables could be in the same database, and it would not make much of a difference). I have an SQL stored procedure that pre-calculates possible matches. The form I am developing will display these possible matches to the user who will then decide which row in one database corresponds to what row in the other database. The matching is done based on data resemblance.

It will look like this:

Matching interface

The Search box is for retrieving a match by hand, if this is necessary. The Action column will contain buttons to perform the matching. But here, we don't need to care about these.

Of course, I could use nested GridViews or nested Repeaters to achieve this, but is it the proper way of doing this? It would mean to issue one query to the database to retrieve rows from database DB1 and then to issue one query to database DB2 for each row in DB1. Typically, there will be hundreds or thousands of rows in DB1; let's say up to 2000. Also, some people recommend using Repeaters over GridViews, but what if paging is required on the main data source (DB1 in my case)?

Since the information in DB1 and DB2 is similar, I thought I could use a UNION query to merge data from DB1 and DB2. I am able to do that, except I don't know then how I can do paging using this method. Using paging with this scenario, I risk having some DB2 matches for one DB1 entry split over two pages, and I want to avoid this.

Jean-François Beauchamp
  • 5,027
  • 8
  • 37
  • 74
  • how many fields are you comparing. For upto 5 field, it might work butwith more field, it will get clumsy in just one gridview. – Hammad Khan Dec 22 '12 at 04:12
  • @Thecrocodilehunter I am comparing 4 fields, but the GridView will have 10 columns. However, my question is more about how the data should be retrieved than about the presentation. – Jean-François Beauchamp Dec 22 '12 at 10:56

0 Answers0