Net4x.MergeTables
1.3.0.26250
dotnet add package Net4x.MergeTables --version 1.3.0.26250
NuGet\Install-Package Net4x.MergeTables -Version 1.3.0.26250
<PackageReference Include="Net4x.MergeTables" Version="1.3.0.26250" />
<PackageVersion Include="Net4x.MergeTables" Version="1.3.0.26250" />
<PackageReference Include="Net4x.MergeTables" />
paket add Net4x.MergeTables --version 1.3.0.26250
#r "nuget: Net4x.MergeTables, 1.3.0.26250"
#:package Net4x.MergeTables@1.3.0.26250
#addin nuget:?package=Net4x.MergeTables&version=1.3.0.26250
#tool nuget:?package=Net4x.MergeTables&version=1.3.0.26250
Net4x.MergeTables
A Windows Forms window that puts two database tables side by side and merges one into the other, plus the logic behind it as a library you can drive yourself.
Both sides are chosen at run time: a connection on the left, a connection on the right, a table on each. The grids show what those tables hold, and Merge merges the left table into the right one.
Copyright: Copyright (c) Piero Viano. All rights reserved. Authors: Piero Viano Company: Piero Viano
Target frameworks
net40, net45, net6.0-windows, net8.0-windows, net10.0-windows. The package is Windows Forms, so
the .NET targets are the Windows ones.
Using the window
using System;
using System.Windows.Forms;
using MergeTables;
internal static class Program
{
[STAThread]
private static void Main()
{
Application.Run(new MergeForm());
}
}
MergeTables.MergeProgram.Main does exactly that, so the package also runs as it stands.
MergeForm is an ordinary Form: it can be shown modally, hosted in an MDI parent, or embedded like any
other form.
What the buttons do
| Button | What it does |
|---|---|
| Refresh | Reads the connections from the configuration again and rebinds both sides. |
< = > |
Exchanges the two sides. Each side reloads its tables from the database it now shows. |
| Merge | Reads both tables and merges the left one into the right one, adding the columns the right lacks. |
The merge is done on the DataTable read from the right side; it is not written back to the database.
Configuration
The two connection lists are built from the application configuration, through ConfigurationLibrary:
- every entry whose value contains
data source=(in any case) is offered as a connection, and the entry key is the name shown in the list; - the entry named
providerNamenames the ADO.NET provider all connections are opened with.
<configuration>
<appSettings>
<add key="providerName" value="System.Data.SqlClient" />
<add key="Production" value="data source=server;initial catalog=Sales;integrated security=True" />
<add key="Staging" value="data source=other;initial catalog=Sales;integrated security=True" />
</appSettings>
</configuration>
The left list opens on the first connection and the right one on the second. Environment variables are read as configuration entries too, so a connection can be handed to the program from outside its config file.
Using the logic without the window
The window is a thin shell over two classes, both usable on their own.
MergeTables.Logic.DatabaseLogic — the database side:
using DataAccessLibrary.DataAccess;
using MergeTables.Logic;
// Every connection the configuration holds, by name.
var connections = DatabaseLogic.Instance.GetConnectionsDictionary();
IDataBaseDataAccess left = DatabaseLogic.Instance.GetDatabase("Production");
IDataBaseDataAccess right = DatabaseLogic.Instance.GetDatabase("Staging");
string[] tables = DatabaseLogic.Instance.GetTableNames(left);
var customers = DatabaseLogic.Instance.GetDataTableFromSelect(left, "Customers");
// Reads both tables and merges the first into the second, which is the table returned.
var merged = DatabaseLogic.Instance.MergeTables(left, "Customers", right, "Customers");
Each table name is quoted by the database that holds it, so the two sides do not have to be databases of the same kind.
MergeTables.Logic.UiLogic — the Windows Forms side, driving the controls of a form of your own:
UiLogic.Instance.BindDictionary(connections, comboBoxDatabases, 0);
UiLogic.Instance.ComboBoxWithDbSelectedIndexChanged(comboBoxDatabases, comboBoxTables,
ref tableNames, out var database);
UiLogic.Instance.ComboWithTablesSelectedItemChanged(comboBoxTables, otherComboBoxTables, database,
dataGridView);
UiLogic.Instance.SwapComboBoxContent(comboBoxLeft, comboBoxRight);
UiLogic.Instance.SelectValueOnCombo(comboBoxTables, "Customers");
Nothing here needs a form that has been shown: a combo box that is not on a form yet keeps its selection on its data source, and a combo box holding anything other than a connection or a table name is left alone rather than refused.
Dependencies
Net4x.CommandBindingLibrary, Net4x.DataAccessLibrary.Data.Work, Net4x.InputBoxLibrary.WinForms,
Net4x.UtilityLibrary, Net4x.Windows.Library, Net4x.WindowsFormsLibrary.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0-windows7.0 is compatible. net7.0-windows was computed. net8.0-windows was computed. net8.0-windows7.0 is compatible. net9.0-windows was computed. net10.0-windows was computed. net10.0-windows7.0 is compatible. |
| .NET Framework | net40 is compatible. net403 was computed. net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
.NETFramework 4.0
- Net4x.CommandBindingLibrary (>= 1.3.0.26241)
- Net4x.DataAccessLibrary.Data.Work (>= 2.3.0.26246)
- Net4x.InputBoxLibrary.WinForms (>= 2.0.0.26250)
- Net4x.UtilityLibrary (>= 1.5.1.26236)
- Net4x.Windows.Library (>= 1.1.0.3)
- Net4x.WindowsFormsLibrary (>= 2.0.0.26250)
-
.NETFramework 4.5
- Net4x.CommandBindingLibrary (>= 1.3.0.26241)
- Net4x.DataAccessLibrary.Data.Work (>= 2.3.0.26246)
- Net4x.InputBoxLibrary.WinForms (>= 2.0.0.26250)
- Net4x.UtilityLibrary (>= 1.5.1.26236)
- Net4x.Windows.Library (>= 1.1.0.3)
- Net4x.WindowsFormsLibrary (>= 2.0.0.26250)
-
net10.0-windows7.0
- Net4x.CommandBindingLibrary (>= 1.3.0.26241)
- Net4x.DataAccessLibrary.Data.Work (>= 2.3.0.26246)
- Net4x.InputBoxLibrary.WinForms (>= 2.0.0.26250)
- Net4x.UtilityLibrary (>= 1.5.1.26236)
- Net4x.Windows.Library (>= 1.1.0.3)
- Net4x.WindowsFormsLibrary (>= 2.0.0.26250)
-
net6.0-windows7.0
- Net4x.CommandBindingLibrary (>= 1.3.0.26241)
- Net4x.DataAccessLibrary.Data.Work (>= 2.3.0.26246)
- Net4x.InputBoxLibrary.WinForms (>= 2.0.0.26250)
- Net4x.UtilityLibrary (>= 1.5.1.26236)
- Net4x.Windows.Library (>= 1.1.0.3)
- Net4x.WindowsFormsLibrary (>= 2.0.0.26250)
-
net8.0-windows7.0
- Net4x.CommandBindingLibrary (>= 1.3.0.26241)
- Net4x.DataAccessLibrary.Data.Work (>= 2.3.0.26246)
- Net4x.InputBoxLibrary.WinForms (>= 2.0.0.26250)
- Net4x.UtilityLibrary (>= 1.5.1.26236)
- Net4x.Windows.Library (>= 1.1.0.3)
- Net4x.WindowsFormsLibrary (>= 2.0.0.26250)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.3.0.26250 | 83 | 9/7/2026 |
| 1.3.0 | 309 | 4/4/2025 |
| 1.1.0 | 284 | 8/27/2023 |
| 1.1.0-at20230506055424 | 258 | 5/7/2023 |