RedGate.SQLDataCompare.Engine.ResultsStore Namespace : Store Class |
A data set containing a collection of rows.
For a list of all members of this type, see Store members.
|
System.Object
RedGate.SQLDataCompare.Engine.ResultsStore.Store
[Visual Basic]
Public Class Store
[C#]
public class Store
[C++]
public __gc class Store
[C++/CLI]
public ref class Store
SQL Data Compare returns results from a comparison as a ResultsStore class. A ResultsStore contains a number of field definitions. The fields can be of a number of different data types.
See FieldPair for more information on how to cross reference the ResultsStore to the underlying database tables being compared.
To access the data in a ResultsStore, use the GetReader method to retrieve a Reader that can be used for data sorting, filtering and retrieval. You can also use the GetEnumerator to retreive a StoreEnumerator that can be used to access the ResultsStore quickly.
Printing out different records in a table.
[C#]
using System;
using RedGate.SQLCompare.Engine;
using RedGate.SQLDataCompare.Engine;
using RedGate.SQLDataCompare.Engine.ResultsStore;
namespace SQLDataCompareCodeSnippets
{
/// <summary>
/// Summary description for StoreExample.
/// </summary>
public class StoreExample
{
public void RunExample()
{
Database db1=new Database();
Database db2=new Database();
db1.RegisterForDataCompare(new ConnectionProperties(".", "WidgetDev"));
db2.RegisterForDataCompare(new ConnectionProperties(".", "WidgetLive"));
using(ComparisonSession session=new ComparisonSession())
{
// Create the mappings between the two databases
TableMappings mappings = new TableMappings();
mappings.CreateMappings(db1.Tables, db2.Tables);
session.CompareDatabases(db1, db2, mappings);
Reader resultsReader=session.TableDifferences["[dbo].[Widgets]"].ResultsStore.GetReader();
// work out the two positions in the fields
int description1=resultsReader.Fields["Description"].OrdinalInResults1;
int description2=resultsReader.Fields["Description"].OrdinalInResults2;
// work out the position of the RecordID column
// this is part of the unique index we are comparing on
int recordID=resultsReader.Fields["RecordID"].OrdinalInResults1;
// sort by description in the first database
resultsReader.SortOrder.ColumnSorts.Add(new ColumnSort(resultsReader.Fields["Description"], true));
resultsReader.ApplySort();
foreach(Row row in resultsReader)
{
Console.Write("{0}:{1},{2}", row.Values[recordID], row.Values[description1], row.Values[description2]);
Console.WriteLine();
}
}
db1.Dispose();
db2.Dispose();
}
}
}
[Visual Basic]
Option Explicit On
Imports RedGate.SQLCompare.Engine
Imports RedGate.SQLDataCompare.Engine
Imports RedGate.SQLDataCompare.Engine.ResultsStore
Public Class StoreExample
Sub RunExample()
Dim session As New ComparisonSession
'register the databases for comparison
Dim db1 As New Database
Dim db2 As New Database
db1.RegisterForDataCompare(New ConnectionProperties(".", "WidgetDev"))
db2.RegisterForDataCompare(New ConnectionProperties(".", "WidgetLive"))
'create an intersection of the tables
Dim mappings As New TableMappings
mappings.CreateMappings(db1.Tables, db2.Tables)
'compare the databases
session.CompareDatabases(db1, db2, mappings)
Dim resultsReader As Reader = session.TableDifferences("[dbo].[Widgets]").ResultsStore.GetReader
'work out the two positions in the fields
Dim description1 As Integer = resultsReader.Fields("Description").OrdinalInResults1
Dim description2 As Integer = resultsReader.Fields("Description").OrdinalInResults2
'work out the position of the RecordID column
'this is part of the unique index we are comparing on
Dim recordID As Integer = resultsReader.Fields("RecordID").OrdinalInResults1
'sort by description in the first database
resultsReader.SortOrder.ColumnSorts.Add(New ColumnSort(resultsReader.Fields("Description"), True))
resultsReader.ApplySort()
Dim row As Row
For Each row In resultsReader
Console.Write("{0}:{1},{2}", row.Values(recordID), row.Values(description1), row.Values(description2))
Console.WriteLine()
Next
'dispose of the objects to delete temporary files
session.Dispose()
db1.Dispose()
db2.Dispose()
End Sub
End Class
Namespace: RedGate.SQLDataCompare.Engine.ResultsStore
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Assembly: RedGate.SQLDataCompare.Engine (in RedGate.SQLDataCompare.Engine.dll)
Store Members | RedGate.SQLDataCompare.Engine.ResultsStore Namespace
© 2003 - 2006 Red Gate Software Ltd. All Rights Reserved.