Options

How to set ORDER BY

srikmrsrikmr Posts: 16
edited May 10, 2007 11:22AM in SQL Toolkit Previous Versions
Hi,
I would like to give the ORDER BY clause on my query.
Here is my code.
 // Create the mappings
                    tableMapping = (TableMapping)mappings.Join(db1.Tables["[dbo].[LogEventData]"], db2.Tables["[dbo].[DataTable1]"]);
                    // Set the custom comparison key for the table
                    tableMapping.MatchingMappings.Clear();
                    tableMapping.MatchingMappings.Add(tableMapping.FieldMappings["ID"]);

                    // Setting the colums to be excluded
                    foreach (FieldMapping m in tableMapping.FieldMappings)
                    {
                        if (m == tableMapping.FieldMappings["tsUpdateTimestamp"])
                            m.Include = false;
                    }

                    // Setting the where clauses. Only the relevant rows will be compared.
                    WhereClause w2 = new WhereClause();
                    
                    w2.Clause1 = "iLogID in (select iLogID from LogEvent where iTranID = '" + iOldID + "')";
                    w2.Clause2 = "iLogEventID in (select iLogID from LogEvent where iTranID = '" + iNewID + "')";
                              
                    tableMapping.Where = w2;
      // TO DO: WRITE CODE TO SET THE ORDER BY Clause           
tableMapping.RefreshMappingStatus();
                    // Peform the comparison
                    session.CompareDatabases(db1, db2, mappings);

Now i need to add the ORDER BY condition for my query. How can i do it?
Thanks
srikmr

Comments

Sign In or Register to comment.