Comparing Table Data Between Two Tables in c#

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using TableComparisonDLL;using System.Data.SqlClient;using System.Collections;namespace
{
TableComparisonpublic partial class Form1 : Form{

{
InitializeComponent();
}











{
public Form1()public String sConstring = null;public String ConnectionName = null;public SqlConnection oCon;public DataSet ds3, ds2;public SqlDataAdapter ad1, ad2;public SqlCommand cmd1, cmd2;DataTable Different1 = new DataTable();private ToolTip _FieldTip = new ToolTip();internal bool[] ValueShouldBeQuoted;private void butCompare_Click(object sender, EventArgs e)try{
Comparer();
ConfigDb.Visible =
ConnectDb.Visible =
ComparePan.Visible =
}

{

}
}


{
false;false;true; catch (Exception ex )MessageBox.Show(ex.Message);private void Comparer()try{




Tr.AccessDiff1(txtfromserver.Text.Trim(), cmbfromdb.Text.Trim(), Frmtable1.Text.Trim(), txtuser1.Text.Trim(), txtpass1.Text.Trim(), txttoserver.Text.Trim(), cmbtodbname.Text.Trim(), Totable.Text.Trim(), txtuser2.Text.Trim(), txtpass2.Text.Trim(), ColumnList1.Text.Trim());
TableComparer Tr = new TableComparer();/////////////////////////////////////////////////////////////////////////First Column TableValue HidedataGridView2.DataSource = Tr.DtR;
dataGridView1.DataSource = Tr.DtR1;
datagridIdenticall.DataSource = Tr.DTRIDENTICAl;

dataGridMissing1.DataSource = Tr.DTRMissing1;
dataGridMissing2.DataSource = Tr.DTRMissing2;

lblsource.Text = cmbfromdb.Text.Trim();
lblsest.Text = cmbtodbname.Text.Trim();


dataGridView2.Columns[0].Visible =
dataGridView1.Columns[0].Visible =
false;false;//datagridIdenticall.Columns[0].Visible = false;dataGridMissing1.Columns[0].Visible =
dataGridMissing2.Columns[0].Visible =


false;false;//////////////////////////////////////////////////////////////////////

dtResult.Columns.Add(
dtResult.Columns.Add(
dtResult.Columns.Add(
dtResult.Columns.Add(
dtResult.Columns.Add(
dtResult.Rows.Add(Tr.DtR1.Rows.Count, Tr.DtR.Rows.Count, Tr.DTRIDENTICAl.Rows.Count, Tr.DTRMissing1.Rows.Count, Tr.DTRMissing2.Rows.Count);
dataGridSummary.DataSource = dtResult;
dataGridSummary.AutoSizeColumnsMode =

DataTable dtResult = new DataTable();"Source Different");"Target Different");"Identical ");"Missing From Source");"Missing From Target");DataGridViewAutoSizeColumnsMode.ColumnHeader;// Datagridview DataSource Source //dataGridView2.DataSource = Tr.Mer;//dataGridView1.DataSource = Tr.Mer1;//datagridIdenticall.DataSource = Tr.MerIdentical;//dataGridMissing1.DataSource = Tr.MerMissing1;//dataGridMissing2.DataSource = Tr.MerMissing2;
// AccessDiff1();

// dataGridView2.DataSource = DtR;// dataGridView1.DataSource = DtR1;
// DataGridview Query //dtGridInsert1.DataSource = Tr.DtInsertTable1;//dtgridinsert2.DataSource = Tr.DtInsertTable2;//dtgridupdateTable1.DataSource = Tr.DtUpdateTable1;//dtgridUpdateTable2.DataSource = Tr.DtUpdateTable2;//dtGridDeleteTable1.DataSource = Tr.DtDeleteTable1;//dtgridDeleteTable2.DataSource = Tr.DtDeleteTable2;


{

{

{
dataGridView1.Rows[j].Cells[i].Style.ForeColor =
dataGridView2.Rows[j].Cells[i].Style.ForeColor =
dataGridView1.Rows[j].Cells[i].Style.BackColor =
dataGridView2.Rows[j].Cells[i].Style.BackColor =
for (int i = 0; i < dataGridView1.Columns.Count; i++)for (int j = 0; j < dataGridView2.Rows.Count; j++)if (!dataGridView1.Rows[j].Cells[i].Value.Equals(dataGridView2.Rows[j].Cells[i].Value))Color.Red;Color.Red;Color.White;Color.White;//dataGridView1.Rows[j].Cells[i].Style.Font = new Font("Times New Roman", 11.75F);//dataGridView1.Rows[j].Cells[i].Style.Font = new Font("Times New Roman", 11.75F);}
}
}
oCon.Close();
}

{

}
}


{
catch (Exception ex)MessageBox.Show(ex.Message);public AutoCompleteStringCollection test(string txtfromserver)try{


_sql.Open();



DA.Fill(DT);

{
DBName.Add(row[
}

}

{

}
}

{
AutoCompleteStringCollection DBName = new AutoCompleteStringCollection();SqlConnection _sql = new SqlConnection("Server =" + txtfromserver + "; User ID =" + txtuser1.Text + "; Password =" + txtpass1.Text + "; Trusted_Connection =False;");SqlDataAdapter DA = new SqlDataAdapter("select * from sys.databases where name like 'SnippetKey%'", _sql);DataTable DT = new DataTable();foreach (DataRow row in DT.Rows)"name"].ToString());return DBName;catch(Exception ez)throw ez;private void showTooltip(Control cntl, string message)try{
_FieldTip.IsBalloon =
_FieldTip.Show(
_FieldTip.Show(message, cntl, 3000);
}

{

}

}

{
true;"", cntl);catch (Exception ex )MessageBox.Show(ex.Message);public AutoCompleteStringCollection GetColumnName()try{

sConstring =
AutoCompleteStringCollection Column1 = new AutoCompleteStringCollection();"Data Source=" + txtfromserver.Text.Trim() + ";Initial Catalog=" + cmbfromdb.Text.Trim() + ";user=" + txtuser1.Text.Trim() + ";password=" + txtpass1.Text.Trim() + " ";//sConstring = "Data Source=" + txttoserver.Text + " ;Initial Catalog= " + cmbtodbname.Text + ";Integrated Security=SSPI";
oCon =
oCon.ConnectionString = sConstring;

oCon.Open();
new SqlConnection();if (oCon.State == ConnectionState.Closed)SqlDataAdapter oDa = new SqlDataAdapter("Select column_name from INFORMATION_SCHEMA.COLUMNS where table_name='" + Frmtable1.Text + "' ", oCon); //select Distinct pagetype from DefaultCoords order by pagetype
oDa.Fill(dt);

{
Column1.Add(dr[
}
CheckColumnList1.Items.Clear();
CheckColumnList2.Items.Clear();


{
CheckColumnList1.Items.Add(dr[
CheckColumnList2.Items.Add(dr[
}



}

{

}
}


{
DataTable dt = new DataTable();foreach (DataRow dr in dt.Rows)"column_name"].ToString());foreach (DataRow dr in dt.Rows)"Column_name"].ToString());"Column_name"].ToString());return Column1;catch (Exception ex)throw ex;public String[] GetFromdbname(String txtfromserver)SqlConnection oCon3 = null; ;try{

sConstring =
oCon3 =

oCon3.Open();
String[] Sdbnanme = null;"Data Source=" + txtfromserver + " ;user=" + txtuser1.Text + ";password=" + txtpass1.Text + " ";new SqlConnection(sConstring);if (oCon3.State == ConnectionState.Closed)SqlDataAdapter oDatAdop = new SqlDataAdapter("select * from sys.databases where name like 'SnippetKey%'", oCon3); //select Distinct pagetype from DefaultCoords order by pagetype
oDatAdop.Fill(odtSet,
Sdbnanme =

{
Sdbnanme[ilp] = odtSet.Tables[
}

}

{

}
DataSet odtSet = new DataSet();"details");new String[odtSet.Tables["details"].Rows.Count];for (Int32 ilp = 0; ilp < odtSet.Tables["details"].Rows.Count; ilp++)"details"].Rows[ilp].ItemArray[0].ToString();return Sdbnanme;catch (Exception ex)MessageBox.Show(ex.Message, "Error Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);finally{
oCon3.Close();
}

}




{
return null;public String[] GetFromTablename(String txtfromserver, String FromDb)try{


sConstring =
oCon =
oCon.ConnectionString = sConstring;

oCon.Open();
Db =
String Db;String[] Sdbnanme = null;"Data Source=" + txtfromserver + " ;Initial Catalog=" + cmbfromdb.Text + " ;user=" + txtuser1.Text + ";password=" + txtpass1.Text + " ";new SqlConnection();if (oCon.State == ConnectionState.Closed)"[" + txtfromserver + "]" + ".master." + "sys.tables order by name ";SqlDataAdapter oDatAdop = new SqlDataAdapter("select * from sys.tables order by name", oCon); //select Distinct pagetype from DefaultCoords order by pagetype
oDatAdop.Fill(odtSet,
Sdbnanme =

{
Sdbnanme[ilp] = odtSet.Tables[
}

}

{

}
DataSet odtSet = new DataSet();"details");new String[odtSet.Tables["details"].Rows.Count];for (Int32 ilp = 0; ilp < odtSet.Tables["details"].Rows.Count; ilp++)"details"].Rows[ilp].ItemArray[0].ToString();return Sdbnanme;catch (Exception ex)MessageBox.Show(ex.Message, "Error Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);finally{
oCon.Close();
}

}


{
return null;public String[] GetTodbname(String txttoserver)try{


sConstring =
oCon =
oCon.ConnectionString = sConstring;

oCon.Open();
Db =
String Db;String[] Sdbnanme = null;"Data Source=" + txttoserver + " ;user=" + txtuser2.Text + ";password=" + txtpass2.Text + " ";new SqlConnection();if (oCon.State == ConnectionState.Closed)"[" + txttoserver + "]" + ".master." + "sys.databases";SqlDataAdapter oDatAdop = new SqlDataAdapter("select * from sys.databases where name like 'SnippetKey%'", oCon); //select Distinct pagetype from DefaultCoords order by pagetype
oDatAdop.Fill(odtSet,
Sdbnanme =

{
Sdbnanme[ilp] = odtSet.Tables[
}

}

{

}
DataSet odtSet = new DataSet();"details");new String[odtSet.Tables["details"].Rows.Count];for (Int32 ilp = 0; ilp < odtSet.Tables["details"].Rows.Count; ilp++)"details"].Rows[ilp].ItemArray[0].ToString();return Sdbnanme;catch (Exception ex)MessageBox.Show(ex.Message, "Error Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);finally{
oCon.Close();
}

}


{

{
return null;private void cmbfromdb_SelectedIndexChanged(object sender, EventArgs e)if (txtfromserver.Text != "" && cmbfromdb.Text != "")string[] sdbName = null;try{
Frmtable1.Items.Clear();
sdbName = GetFromTablename(txtfromserver.Text, cmbfromdb.Text);
Frmtable1.Items.AddRange(sdbName);
Frmtable1.Text =
}

{

}
}
}


{

{
"";catch (Exception ex)MessageBox.Show(ex.Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);private void cmbtodbname_SelectedIndexChanged(object sender, EventArgs e)if (txttoserver.Text != "" && cmbtodbname.Text != "")string[] sdbName = null;try{
Totable.Items.Clear();
sdbName = GetToTablename(txttoserver.Text, cmbtodbname.Text);
Totable.Items.AddRange(sdbName);
Totable.Text =
}

{

}
}
}


{
"";catch (Exception ex)MessageBox.Show(ex.Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);public String[] GetToTablename(String txttoserver, String ToDb)try{


sConstring =
oCon =
oCon.ConnectionString = sConstring;

oCon.Open();
Db =
String Db;String[] Sdbnanme = null;"Data Source=" + txttoserver + " ;Initial Catalog= " + cmbtodbname.Text + " ;user=" + txtuser2.Text + ";password=" + txtpass2.Text + " ";new SqlConnection();if (oCon.State == ConnectionState.Closed)"[" + txttoserver + "]" + ".master." + "sys.tables order by name";SqlDataAdapter oDatAdop = new SqlDataAdapter("select * from sys.tables order by name", oCon); //select Distinct pagetype from DefaultCoords order by pagetype
oDatAdop.Fill(odtSet,
Sdbnanme =

{
Sdbnanme[ilp] = odtSet.Tables[
}

}

{

}
DataSet odtSet = new DataSet();"details");new String[odtSet.Tables["details"].Rows.Count];for (Int32 ilp = 0; ilp < odtSet.Tables["details"].Rows.Count; ilp++)"details"].Rows[ilp].ItemArray[0].ToString();return Sdbnanme;catch (Exception ex)MessageBox.Show(ex.Message, "Error Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);finally{
oCon.Close();
}

}


{
return null;private void txtpass2_Leave(object sender, EventArgs e)try{

{

{
if (txtpass2.Text.Trim() != "")if (txttoserver.Text != "")string[] sdbName = null;try{
cmbtodbname.Items.Clear();
cmbtodbname.Text =
sdbName = GetTodbname(txttoserver.Text);
cmbtodbname.Items.AddRange(sdbName);
cmbtodbname.Text =
}

{

}
}
}
}

{

}
}


{

{
"";"";catch (Exception ex)MessageBox.Show(ex.Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);catch (Exception ex )MessageBox.Show(ex.Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);private void txtpass1_Leave_1(object sender, EventArgs e)if (txtpass1.Text.Trim() != "" )try{

{
if (txtfromserver.Text != "")string[] sdbName = null;try{
cmbfromdb.Items.Clear();
cmbfromdb.Text =
sdbName = GetFromdbname(txtfromserver.Text);
cmbfromdb.Items.AddRange(sdbName);
cmbfromdb.Text =
}

{

}
}

}

{

}
}
}

{
"";"";catch (Exception ex)MessageBox.Show(ex.Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);catch (Exception ex)MessageBox.Show(ex.Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);private void ColumnList1_Leave(object sender, EventArgs e)try{

{

ColumnList2.Text = tt1;
}
}

{

}
}

{
if (ColumnList1.Text != "")String tt1 = ColumnList1.Text;catch (Exception ex)MessageBox.Show(ex.Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);private void Frmtable1_Leave(object sender, EventArgs e)try{

{

Totable.Text = tt;
}
ColumnList1.AutoCompleteCustomSource = GetColumnName();

Getprimarykey();
if (Frmtable1.Text != "")string tt = Frmtable1.Text;//ColumnList1.Text = "";//ColumnList2.Text = ""; }

{

}
}


{
catch (Exception ex)MessageBox.Show(ex.Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);private void Form1_Load(object sender, EventArgs e)try{//txtfromserver.Text = "gun-ssw-4";//txttoserver.Text = "gun-ssw-4";//cmbfromdb.Text = "SnippetKey_UHC_PUNE_KeyProfiles";//cmbtodbname.Text = "Snippetkey_uhc_pccf428_grpb";txtfromserver.Text =
txttoserver.Text =
cmbfromdb.Text =
cmbtodbname.Text =

txtuser1.Text =
txtuser2.Text =
txtpass1.Text =
txtpass2.Text =
ConnectDb.Visible =
ConfigDb.Visible =
ComparePan.Visible =
panelquery.Visible =
PanelDifferentOnly.Visible =
}

{

}

}


{
"gun-ssw-3";"gun-ssw-3";"snippetkey_For_Testing";"Snippetkey_For_Testing_4"; "ffuserAdmin";"ffuserAdmin";"Admin1234";"Admin1234";true;false;false;false;false; catch (Exception ex )MessageBox.Show(ex.Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);private void CheckColumnList1_Leave(object sender, EventArgs e)try{

{
ColumnList1.Text =
ColumnList2.Text =
}

{


{
s = s + CheckColumnList1.CheckedItems[x].ToString() +
}
ColumnList1.Text = s.TrimEnd(
ColumnList2.Text = s.TrimEnd(
}
}

{

}








}

{
if (CheckColumnList1.CheckedItems.Count == 0)"";"";else if (CheckColumnList1.CheckedItems.Count != 0)string s = "";for (int x = 0; x <= CheckColumnList1.CheckedItems.Count - 1; x++)",";',');',');catch (Exception ex)MessageBox.Show(ex.Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);private void CheckColumnList1_SelectedIndexChanged(object sender, EventArgs e)try{

{
ColumnList1.Text =
ColumnList2.Text =
}

{


{
s = s + CheckColumnList1.CheckedItems[x].ToString() +
}
ColumnList1.Text = s.TrimEnd(
ColumnList2.Text = s.TrimEnd(
}
}

{

}
}


{
if (CheckColumnList1.CheckedItems.Count == 0)"";"";else if (CheckColumnList1.CheckedItems.Count != 0)string s = "";for (int x = 0; x <= CheckColumnList1.CheckedItems.Count - 1; x++)",";',');',');catch (Exception ex)MessageBox.Show(ex.Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);private void btnBack_Click(object sender, EventArgs e)try{

{
btnNext.Enabled =
btnNext.Text =
btnBack.Enabled =
}

{
btnBack.Enabled =
btnNext.Enabled =
btnNext.Text =
ConnectDb.Visible =
ConfigDb.Visible =
ComparePan.Visible =
panelquery.Visible =
PanelDifferentOnly.Visible =
}

{
btnBack.Enabled =
ConfigDb.Visible =
ConnectDb.Visible =
btnNext.Enabled =
ComparePan.Visible =
panelquery.Visible =
PanelDifferentOnly.Visible =
}

{
btnBack.Enabled =
ConfigDb.Visible =
ConnectDb.Visible =
btnNext.Enabled =
ComparePan.Visible =
panelquery.Visible =
PanelDifferentOnly.Visible =
}
}

{

}
}


{
if (ConnectDb.Visible == true)true; "Connect"; false;else if (ConfigDb.Visible == true)true;true; "Compare"; true;false;false;false;false; else if (ComparePan.Visible == true)true;true;false;true; false;false;false; else if (panelquery.Visible == true)true;true;false;true;false;false;false; catch (Exception ex)MessageBox.Show(ex.Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);private void btnNext_Click(object sender, EventArgs e)try{

{

{
txtfromserver.Focus();
showTooltip(txtfromserver,
if (ConnectDb.Visible == true)if (String.IsNullOrEmpty(txtfromserver.Text.Trim()))"Mandatory Field Can Not Be Empty, Please specify valid instance name");// MessageBox.Show("Mandatory Field Can Not Be Empty, Please specify valid instance name ", "Table Comparer", MessageBoxButtons.OK, MessageBoxIcon.Information);
}

{
txttoserver.Focus();
showTooltip(txttoserver,
return;if (String.IsNullOrEmpty(txttoserver.Text.Trim()))"Mandatory Field Can Not Be Empty, Please specify valid instance name");// MessageBox.Show("Mandatory Field Can Not Be Empty, Please specify valid instance name ", "Table Comparer", MessageBoxButtons.OK, MessageBoxIcon.Information);
}

{
txtuser1.Focus();
showTooltip(txtuser1,
return;if (String.IsNullOrEmpty(txtuser1.Text.Trim()))"Mandatory Field Can Not Be Empty, Please specify valid User name");// MessageBox.Show("Mandatory Field Can Not Be Empty, Please specify valid User name ", "Table Comparer", MessageBoxButtons.OK, MessageBoxIcon.Information);
}

{
txtuser2.Focus();
showTooltip(txtuser2,
return;if (String.IsNullOrEmpty(txtuser2.Text.Trim()))"Mandatory Field Can Not Be Empty, Please specify valid User name");// MessageBox.Show("Mandatory Field Can Not Be Empty, Please specify valid User Name ", "Table Comparer", MessageBoxButtons.OK, MessageBoxIcon.Information);
}

{
txtpass1.Focus();
showTooltip(txtpass1,
return;if (String.IsNullOrEmpty(txtpass1.Text.Trim()))"Mandatory Field Can Not Be Empty, Please specify valid PassWord");// MessageBox.Show("Mandatory Field Can Not Be Empty, Please specify valid PassWord ", "Table Comparer", MessageBoxButtons.OK, MessageBoxIcon.Information);
}

{
txtpass2.Focus();
showTooltip(txtpass2,
return;if (String.IsNullOrEmpty(txtpass2.Text.Trim()))"Mandatory Field Can Not Be Empty, Please specify valid PassWord");// MessageBox.Show("Mandatory Field Can Not Be Empty, Please specify valid PassWord ", "Table Comparer", MessageBoxButtons.OK, MessageBoxIcon.Information);
}

ComparePan.Visible =
ConnectDb.Visible =
ConfigDb.Visible =
btnBack.Enabled =
PanelDifferentOnly.Visible =




}


{
btnNext.Text =
btnBack.Enabled =

{
cmbfromdb.Focus();
showTooltip(cmbfromdb,
return;false;false;true;true;false;else if (ConfigDb.Visible == true)"Compare";true;if (String.IsNullOrEmpty(cmbfromdb.Text.Trim()))"Mandatory Field Can Not Be Empty, Please specify valid DataBase name");// MessageBox.Show("Mandatory Field Can Not Be Empty, Please specify valid DataBase name ", "Table Comparer", MessageBoxButtons.OK, MessageBoxIcon.Information);
}

{
cmbtodbname.Focus();
showTooltip(cmbtodbname,
return;if (String.IsNullOrEmpty(cmbtodbname.Text.Trim()))"Mandatory Field Can Not Be Empty, Please specify valid DataBase name");// MessageBox.Show("Mandatory Field Can Not Be Empty, Please specify valid DataBase name ", "Table Comparer", MessageBoxButtons.OK, MessageBoxIcon.Information);
}

{
Frmtable1.Focus();
showTooltip(Frmtable1,
return;if (String.IsNullOrEmpty(Frmtable1.Text.Trim()))"Mandatory Field Can Not Be Empty, Please specify valid Table name");// MessageBox.Show("Mandatory Field Can Not Be Empty, Please specify valid Table name ", "Table Comparer", MessageBoxButtons.OK, MessageBoxIcon.Information);
}


{
showTooltip(ColumnList1,
return;if (ColumnList1.Text.ToLower().Trim() != ColumnList2.Text.ToLower().Trim())"Column List Should be Same");// MessageBox.Show("Column List Should be Same ", "Table Comparer", MessageBoxButtons.OK, MessageBoxIcon.Information);
}

{
return;if (CheckColumnList1.CheckedItems.Count ==0)var items = CheckColumnList1.Items[0]; //items.Add("Perls");// items.Add("Checked", true);}


ComparePan.Visible =
ConnectDb.Visible =
ConfigDb.Visible =
PanelDifferentOnly.Visible =
Comparer();
btnNext.Enabled =
}
}

{

}
}



{

}




{
true;false;false;false; false; catch (Exception ex)MessageBox.Show(ex.Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);private void btnCancel_Click(object sender, EventArgs e)this.Close();private void datagridIdenticall_SelectionChanged(object sender, EventArgs e)try{

{
cell.Style =
{
BackColor =
Font =
};
}
}

{

}
}


{
foreach (DataGridViewCell cell in ((DataGridView)sender).SelectedCells)new DataGridViewCellStyle()Color.White,new Font("Tahoma", 8.25F),catch (Exception ex)MessageBox.Show(ex.Message, "Config Manager", MessageBoxButtons.OK, MessageBoxIcon.Information);private void datagridIdenticall_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)try{
e.CellStyle.BackColor =
e.CellStyle.ForeColor =
}

{

}
}


{
Color.WhiteSmoke;Color.Black;catch (Exception ex)MessageBox.Show(ex.Message, "Config Manager", MessageBoxButtons.OK, MessageBoxIcon.Information);private void SqlSync_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)try{
panelquery.Visible =
createInsertStatementsForTable1();
createInsertStatementsForTable2();
createUpdateStatementsForTable1();
createUpdateStatementsForTable2();

ComparePan.Visible =
ConnectDb.Visible =
ConfigDb.Visible =
PanelDifferentOnly.Visible =
true;false;false;false;false;//dtGridInsert.DataSource = }

{

}
}


{
catch (Exception ex )MessageBox.Show(ex.Message, "Config Manager", MessageBoxButtons.OK, MessageBoxIcon.Information);private void LinkDifferent_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)try{
panelquery.Visible =
ComparePan.Visible =
ConnectDb.Visible =
ConfigDb.Visible =
PanelDifferentOnly.Visible =
}

{

}
}


{
true;false;false;false;true; catch (Exception ex )MessageBox.Show(ex.Message, "Config Manager", MessageBoxButtons.OK, MessageBoxIcon.Information);public void AccessDiff1()try{
dataGridView2.DataSource =
dataGridView1.DataSource =
datagridIdenticall.DataSource =
dataGridMissing1.DataSource =
dataGridMissing2.DataSource =

"";"";"";"";"";string sCon;// sConstring = "Data Source=" + txtfromserver + " ;Initial Catalog=" + cmbfromdb.Text + " ;user=" + txtuser1.Text + ";password=" + txtpass1.Text + " ";// sCon = "Data Source=" + txttoserver.Text + " ;Initial Catalog= " + cmbtodbname.Text + ";Integrated Security=SSPI";sCon =


oCon =
oCon.ConnectionString = sCon;

oCon.Open();




oDatAdop1.Fill(odtSet1);




oDatAdop2.Fill(odtSet2);
datagridIdenticall.DataSource = odtSet2.Tables[0];
















{
DtR.Columns.Add(tt);
DtR1.Columns.Add(tt);
DTRMissing2.Columns.Add(tt);
DTRMissing1.Columns.Add(tt);
}


dataGridView2.DataSource =
dataGridView1.DataSource =

{

{

{
"Data Source=" + txtfromserver.Text.Trim() + " ;Initial Catalog=" + cmbfromdb.Text.Trim() + " ;user=" + txtuser1.Text.Trim() + ";password=" + txtpass1.Text.Trim() + " ";new SqlConnection();if (oCon.State == ConnectionState.Closed)SqlDataAdapter oDatAdop1 = new SqlDataAdapter("select 1 as tablename ,* from ( select * from [" + txtfromserver.Text.Trim() + "]." + cmbfromdb.Text.Trim() + ".dbo." + Frmtable1.Text.Trim() + " with(nolock) except select * from [" + txttoserver.Text.Trim() + "]." + cmbtodbname.Text.Trim() + ".dbo." + Totable.Text.Trim() + " with(nolock) ) as x union all select 2 as tablename ,* from ( select * from [" + txttoserver.Text.Trim() + "]." + cmbtodbname.Text.Trim() + ".dbo." + Totable.Text.Trim() + " with(nolock) except select * from [" + txtfromserver.Text.Trim() + "]." + cmbfromdb.Text.Trim() + ".dbo." + Frmtable1.Text.Trim() + " with(nolock)) as y order by " + ColumnList1.Text + " ", oCon);DataSet odtSet1 = new DataSet();SqlDataAdapter oDatAdop2 = new SqlDataAdapter(" select * from [" + txtfromserver.Text.Trim() + "]." + cmbfromdb.Text.Trim() + ".dbo." + Frmtable1.Text.Trim() + " with(nolock) intersect select * from [" + txttoserver.Text.Trim() + "]." + cmbtodbname.Text.Trim() + ".dbo." + Totable.Text.Trim() + " with(nolock) order by " + ColumnList1.Text + " ", oCon);DataSet odtSet2 = new DataSet();DataTable DTRMissing1 = new DataTable();DataTable DTRMissing2 = new DataTable();DataTable DtR = new DataTable();DataTable DtR1 = new DataTable();DataTable MissingFrom2 = new DataTable();string tablename = "";string worksetid = "";string Itable = "";string Iworkset = "";ComparisonResultsTable compr1 = new ComparisonResultsTable(odtSet1.Tables[0]);foreach (String tt in compr1.ColumnNames)"";"";for (int i = 0; i < odtSet1.Tables[0].Rows.Count; i++)if (i > 0)if (tablename != odtSet1.Tables[0].Rows[i].ItemArray[0].ToString() && worksetid == odtSet1.Tables[0].Rows[i].ItemArray[1].ToString())// DataRow dr1 = odtSet1.Tables[0].Rows[i];
DataRow row = odtSet1.Tables[0].Rows[i];// DataRow dr2 = odtSet1.Tables[0].Rows[i-1];
Itable = row1.ItemArray[0].ToString();
Iworkset = row1.ItemArray[1].ToString();



DataRow row1 = odtSet1.Tables[0].Rows[i - 1];int j = row.ItemArray.Length;//dtDifferent1.Rows.Add(dr1.ItemArray[0], dr1.ItemArray[1], dr1.ItemArray[2], dr1.ItemArray[3], dr1.ItemArray[4], dr1.ItemArray[5], dr1.ItemArray[6]);
//dtdifferent2.Rows.Add(dr2.ItemArray[0], dr2.ItemArray[1], dr2.ItemArray[2], dr2.ItemArray[3], dr2.ItemArray[4], dr2.ItemArray[5], dr2.ItemArray[6]);
{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1]);
}


{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2]);
}


{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3]);
}

{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4]);
}

{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5]);
}

{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5], row1.ItemArray[6]);
}

{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5], row1.ItemArray[6], row1.ItemArray[7]);
}

{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5], row1.ItemArray[6], row1.ItemArray[7], row1.ItemArray[8]);
}

{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5], row1.ItemArray[6], row1.ItemArray[7], row1.ItemArray[8], row1.ItemArray[9]);
}

{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5], row1.ItemArray[6], row1.ItemArray[7], row1.ItemArray[8], row1.ItemArray[9], row1.ItemArray[10]);

}

{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5], row1.ItemArray[6], row1.ItemArray[7], row1.ItemArray[8], row1.ItemArray[9], row1.ItemArray[10], row1.ItemArray[11]);
}

{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5], row1.ItemArray[6], row1.ItemArray[7], row1.ItemArray[8], row1.ItemArray[9], row1.ItemArray[10], row1.ItemArray[11], row1.ItemArray[12]);

}

{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5], row1.ItemArray[6], row1.ItemArray[7], row1.ItemArray[8], row1.ItemArray[9], row1.ItemArray[10], row1.ItemArray[11], row1.ItemArray[12], row1.ItemArray[13]);
}

{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5], row1.ItemArray[6], row1.ItemArray[7], row1.ItemArray[8], row1.ItemArray[9], row1.ItemArray[10], row1.ItemArray[11], row1.ItemArray[12], row1.ItemArray[13], row1.ItemArray[14]);
}

{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5], row1.ItemArray[6], row1.ItemArray[7], row1.ItemArray[8], row1.ItemArray[9], row1.ItemArray[10], row1.ItemArray[11], row1.ItemArray[12], row1.ItemArray[13], row1.ItemArray[14], row1.ItemArray[15]);

}

{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5], row1.ItemArray[6], row1.ItemArray[7], row1.ItemArray[8], row1.ItemArray[9], row1.ItemArray[10], row1.ItemArray[11], row1.ItemArray[12], row1.ItemArray[13], row1.ItemArray[14], row1.ItemArray[15], row1.ItemArray[16]);
}


{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16], row.ItemArray[17]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5], row1.ItemArray[6], row1.ItemArray[7], row1.ItemArray[8], row1.ItemArray[9], row1.ItemArray[10], row1.ItemArray[11], row1.ItemArray[12], row1.ItemArray[13], row1.ItemArray[14], row1.ItemArray[15], row1.ItemArray[16], row1.ItemArray[17]);
}

{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16], row.ItemArray[17], row.ItemArray[18]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5], row1.ItemArray[6], row1.ItemArray[7], row1.ItemArray[8], row1.ItemArray[9], row1.ItemArray[10], row1.ItemArray[11], row1.ItemArray[12], row1.ItemArray[13], row1.ItemArray[14], row1.ItemArray[15], row1.ItemArray[16], row1.ItemArray[17], row1.ItemArray[18]);
}


{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16], row.ItemArray[17], row.ItemArray[18], row.ItemArray[19]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5], row1.ItemArray[6], row1.ItemArray[7], row1.ItemArray[8], row1.ItemArray[9], row1.ItemArray[10], row1.ItemArray[11], row1.ItemArray[12], row1.ItemArray[13], row1.ItemArray[14], row1.ItemArray[15], row1.ItemArray[16], row1.ItemArray[17], row1.ItemArray[18], row1.ItemArray[19]);
}


{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16], row.ItemArray[17], row.ItemArray[18], row.ItemArray[19], row.ItemArray[20]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5], row1.ItemArray[6], row1.ItemArray[7], row1.ItemArray[8], row1.ItemArray[9], row1.ItemArray[10], row1.ItemArray[11], row1.ItemArray[12], row1.ItemArray[13], row1.ItemArray[14], row1.ItemArray[15], row1.ItemArray[16], row1.ItemArray[17], row1.ItemArray[18], row1.ItemArray[19], row1.ItemArray[20]);
}

{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16], row.ItemArray[17], row.ItemArray[18], row.ItemArray[19], row.ItemArray[20], row.ItemArray[21]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5], row1.ItemArray[6], row1.ItemArray[7], row1.ItemArray[8], row1.ItemArray[9], row1.ItemArray[10], row1.ItemArray[11], row1.ItemArray[12], row1.ItemArray[13], row1.ItemArray[14], row1.ItemArray[15], row1.ItemArray[16], row1.ItemArray[17], row1.ItemArray[18], row1.ItemArray[19], row1.ItemArray[20], row1.ItemArray[21]);
}

{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16], row.ItemArray[17], row.ItemArray[18], row.ItemArray[19], row.ItemArray[20], row.ItemArray[21], row.ItemArray[22]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5], row1.ItemArray[6], row1.ItemArray[7], row1.ItemArray[8], row1.ItemArray[9], row1.ItemArray[10], row1.ItemArray[11], row1.ItemArray[12], row1.ItemArray[13], row1.ItemArray[14], row1.ItemArray[15], row1.ItemArray[16], row1.ItemArray[17], row1.ItemArray[18], row1.ItemArray[19], row1.ItemArray[20], row1.ItemArray[21], row1.ItemArray[22]);
}


dataGridView2.DataSource = DtR;
dataGridView1.DataSource = DtR1;
}
if (j == 2)else if (j == 3)else if (j == 4)else if (j == 5)else if (j == 6)else if (j == 7)else if (j == 8)else if (j == 9)else if (j == 10)else if (j == 11)else if (j == 12)else if (j == 13)else if (j == 14)else if (j == 15)else if (j == 16)else if (j == 17)else if (j == 18)else if (j == 19)else if (j == 20)else if (j == 21)else if (j == 22)else if (j == 23)else{
tablename = odtSet1.Tables[0].Rows[i].ItemArray[0].ToString();
worksetid = odtSet1.Tables[0].Rows[i].ItemArray[1].ToString();







{

{
DataRow row = odtSet1.Tables[0].Rows[i - 1];int j = row.ItemArray.Length;if (Iworkset != row.ItemArray[1].ToString())if (row.ItemArray[0].ToString() == "1")// dtmissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6]);
{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1]);
}

{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2]);
}


{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3]);
}

{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4]);
}

{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5]);
}

{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6]);
}

{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7]);
}

{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8]);
}

{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9]);
}

{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10]);
}

{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11]);
}


{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12]);
}

{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13]);
}

{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14]);
}

{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15]);
}

{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16]);
}


{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16], row.ItemArray[17]);
}

{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16], row.ItemArray[17], row.ItemArray[18]);
}

{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16], row.ItemArray[17], row.ItemArray[18], row.ItemArray[19]);
}

{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16], row.ItemArray[17], row.ItemArray[18], row.ItemArray[19], row.ItemArray[20]);
}

dataGridMissing2.DataSource = DTRMissing2;
}
if (j == 2)else if (j == 3)else if (j == 4)else if (j == 5)else if (j == 6)else if (j == 7)else if (j == 8)else if (j == 9)else if (j == 10)else if (j == 11)else if (j == 12)else if (j == 13)else if (j == 14)else if (j == 15)else if (j == 16)else if (j == 17)else if (j == 18)else if (j == 19)else if (j == 20)else if (j == 21)else{

// DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6]);
{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1]);
}

{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2]);
}


{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3]);
}

{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4]);
}

{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5]);
}

{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6]);
}

{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7]);
}

{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8]);
}

{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9]);
}

{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10]);
}

{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11]);
}


{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12]);
}

{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13]);
}

{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14]);
}

{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15]);
}

{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16]);
}


{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16], row.ItemArray[17]);
}

{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16], row.ItemArray[17], row.ItemArray[18]);
}


{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16], row.ItemArray[17], row.ItemArray[18], row.ItemArray[19]);
}


{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16], row.ItemArray[17], row.ItemArray[18], row.ItemArray[19], row.ItemArray[20]);
}

{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16], row.ItemArray[17], row.ItemArray[18], row.ItemArray[19], row.ItemArray[20], row.ItemArray[21]);
}

{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16], row.ItemArray[17], row.ItemArray[18], row.ItemArray[19], row.ItemArray[20], row.ItemArray[21], row.ItemArray[22]);
}

dataGridMissing1.DataSource = DTRMissing1;
}

}
if (j == 2)else if (j == 3)else if (j == 4)else if (j == 5)else if (j == 6)else if (j == 7)else if (j == 8)else if (j == 9)else if (j == 10)else if (j == 11)else if (j == 12)else if (j == 13)else if (j == 14)else if (j == 15)else if (j == 16)else if (j == 17)else if (j == 18)else if (j == 19)else if (j == 20)else if (j == 21)else if (j == 22)else if (j == 23)//else if (Iworkset != dr2.ItemArray[1].ToString())//{// //dtmissing2.Rows.Add(dr.ItemArray[0], dr.ItemArray[1], dr.ItemArray[2], dr.ItemArray[3], dr.ItemArray[4], dr.ItemArray[5], dr.ItemArray[6]);
// dtmissing1.Rows.Add(dr2.ItemArray[0], dr2.ItemArray[1], dr2.ItemArray[2], dr2.ItemArray[3], dr2.ItemArray[4], dr2.ItemArray[5], dr2.ItemArray[6]);// //dataGridMissing2.DataSource = dtmissing2;// dataGridMissing1.DataSource = dtmissing1;
//}}
}
else{
tablename = odtSet1.Tables[0].Rows[i].ItemArray[0].ToString();
worksetid = odtSet1.Tables[0].Rows[i].ItemArray[1].ToString();
}
}
}

{

}
catch (Exception ex)MessageBox.Show(ex.Message, "Error Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);finally{
oCon.Close();
}
}

{

{

}

{

}

{

}

}






{
private string getSqlStringValue(object item)if (item is DBNull)return "null";if (!(item is bool))return item.ToString();if (!((bool)item))return "0";return "1";private void createInsertStatementsForTable1()DataTable dt = new DataTable();try{

Tr.AccessDiff1(txtfromserver.Text.Trim(), cmbfromdb.Text.Trim(), Frmtable1.Text.Trim(), txtuser1.Text.Trim(), txtpass1.Text.Trim(), txttoserver.Text.Trim(), cmbtodbname.Text.Trim(), Totable.Text.Trim(), txtuser2.Text.Trim(), txtpass2.Text.Trim(), ColumnList1.Text.Trim());

{



{
str = str +
}
str = str.Substring(0, str.Length - 2);
dt.Columns.Clear();

dt.Columns.Add(

{
builder.Length = 0;
builder.Append(
builder.Append(Frmtable1.Text.Trim());
builder.Append(
builder.Append(str);
builder.Append(


{

builder.Append(str2);
builder.Append(
}
builder.Length -= 2;
builder.Append(
dt.Rows.Add(builder.ToString());
dtGridInsert1.DataSource = dt;

}

}
}

{

}

}


{

TableComparer Tr = new TableComparer();if (Tr.DTRMissing1.Rows != null)StringBuilder builder = new StringBuilder(0x100);string str = string.Empty;for (int i = 1; i < Tr.DTRMissing1.Columns.Count; i++)"[" + Tr.DTRMissing1.Columns[i] + "], ";"Insert");for (int j = 0; j < Tr.DTRMissing1.Rows.Count; j++)"insert into [");"] (");") values (");object[] itemArray = Tr.DTRMissing1.Rows[j].ItemArray;for (int k = 0; k < Tr.DTRMissing1.Columns.Count; k++)string str2 = this.getSqlStringValue(itemArray[k]);", ");")");catch (Exception ex)MessageBox.Show(ex.Message, "Error Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);private void createInsertStatementsForTable2()DataTable dt = new DataTable();try{

Tr.AccessDiff1(txtfromserver.Text.Trim(), cmbfromdb.Text.Trim(), Frmtable1.Text.Trim(), txtuser1.Text.Trim(), txtpass1.Text.Trim(), txttoserver.Text.Trim(), cmbtodbname.Text.Trim(), Totable.Text.Trim(), txtuser2.Text.Trim(), txtpass2.Text.Trim(), ColumnList1.Text.Trim());

{



{
str = str +
}
str = str.Substring(0, str.Length - 2);
dt.Columns.Clear();
dt.Columns.Add(

{
builder.Length = 0;
builder.Append(
builder.Append(Frmtable1.Text.Trim());
builder.Append(
builder.Append(str);
builder.Append(


{

builder.Append(str2);
builder.Append(
}
builder.Length -= 2;
builder.Append(
dt.Rows.Add(builder.ToString());
dtgridinsert2.DataSource = dt;
}
}
}

{

}
}

{
TableComparer Tr = new TableComparer();if (Tr.DTRMissing2.Rows != null)StringBuilder builder = new StringBuilder(0x100);string str = string.Empty;for (int i = 1; i < Tr.DTRMissing2.Columns.Count; i++)"[" + Tr.DTRMissing2.Columns[i] + "], ";"Insert");for (int j = 0; j < Tr.DTRMissing2.Rows.Count; j++)"insert into [");"] (");") values (");object[] itemArray = Tr.DTRMissing2.Rows[j].ItemArray;for (int k = 0; k < Tr.DTRMissing2.Columns.Count; k++)string str2 = this.getSqlStringValue(itemArray[k]);", ");")");catch (Exception ex)MessageBox.Show(ex.Message, "Error Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);public String Getprimarykey()SqlConnection oCon3 = null; ;try{


sConstring =
oCon3 =

oCon3.Open();



oDatAdop.Fill(odtSet);




{

{

{
Sdbnanme = odtSet.Tables[0].Rows[ilp].ItemArray[0].ToString();

CheckColumnList1.SetItemChecked(index,
}
String Sdbnanme = null;String Sdbnanme1 = null;"Data Source=" + txttoserver.Text.Trim() + " ;Initial Catalog= " + cmbtodbname.Text.Trim() + " ;user=" + txtuser2.Text.Trim() + ";password=" + txtpass2.Text.Trim() + " ";new SqlConnection(sConstring);if (oCon3.State == ConnectionState.Closed)SqlDataAdapter oDatAdop = new SqlDataAdapter("SELECT column_name FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE OBJECTPROPERTY(OBJECT_ID(constraint_name), 'IsPrimaryKey') = 1 AND table_name = '" + Frmtable1.Text + "' ", oCon3);DataSet odtSet = new DataSet();int kk = 0;for (Int32 ilp = 0; ilp < odtSet.Tables[0].Rows.Count; ilp++)if (kk == 0)if (odtSet.Tables[0].Rows.Count == 1)int index = CheckColumnList1.Items.IndexOf(Sdbnanme.ToString().Trim());true);else{
Sdbnanme = odtSet.Tables[0].Rows[ilp].ItemArray[0].ToString();
Sdbnanme1 = odtSet.Tables[0].Rows[ilp + 1].ItemArray[0].ToString();


CheckColumnList1.SetItemChecked(index,
CheckColumnList1.SetItemChecked(index1,
}
}
kk = 1;
}
int index = CheckColumnList1.Items.IndexOf(Sdbnanme.ToString().Trim());int index1 = CheckColumnList1.Items.IndexOf(Sdbnanme1.ToString().Trim());true);true);try{

{
ColumnList1.Text =
ColumnList2.Text =
}

{


{
s = s + CheckColumnList1.CheckedItems[x].ToString() +
}
ColumnList1.Text = s.TrimEnd(
ColumnList2.Text = s.TrimEnd(
}
}

{

}

}

{

}
if (CheckColumnList1.CheckedItems.Count == 0)"";"";else if (CheckColumnList1.CheckedItems.Count != 0)string s = "";for (int x = 0; x <= CheckColumnList1.CheckedItems.Count - 1; x++)",";',');',');catch (Exception ex)MessageBox.Show(ex.Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);return Sdbnanme;catch (Exception ex)MessageBox.Show(ex.Message, "Error Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);finally{
oCon3.Close();
}

}

{

dt.Columns.Add(
return null;private void createUpdateStatementsForTable1()DataTable dt = new DataTable();"Update");try{

Tr.AccessDiff1(txtfromserver.Text.Trim(), cmbfromdb.Text.Trim(), Frmtable1.Text.Trim(), txtuser1.Text.Trim(), txtpass1.Text.Trim(), txttoserver.Text.Trim(), cmbtodbname.Text.Trim(), Totable.Text.Trim(), txtuser2.Text.Trim(), txtpass2.Text.Trim(), ColumnList1.Text.Trim());

{


{
builder.Length = 0;
builder.Append(
builder.Append(Frmtable1.Text.Trim());
builder.Append(


{

{

builder.Append(
builder.Append(CheckColumnList1.Items[c]);
builder.Append(

builder.Append(
builder.Append(str);
builder.Append(
builder.Append(

}
}



{

{

{
builder.Append(
}

{
builder.Append(
}

{
builder.Append(
}

{
builder.Append(
}
builder.Append(
builder.Append(CheckColumnList1.Items[k]);
builder.Append(

builder.Append(
builder.Append(str2);
builder.Append(

count = 1;
count++;
}
}


dt.Rows.Add(builder.ToString());
dtgridupdateTable1.DataSource = dt;
}
}
}

{

}
}


{

dt1.Columns.Add(
TableComparer Tr = new TableComparer();if (Tr.DtR1 != null)StringBuilder builder = new StringBuilder(0x100);for (int i = 0; i < Tr.DtR1.Rows.Count; i++)"update [");"] set ");object[] itemArray = Tr.DtR1.Rows[i].ItemArray;for (int c = 0; c < CheckColumnList1.Items.Count; c++)if (CheckColumnList1.GetItemCheckState(c) == CheckState.Unchecked)"[");"] = ");string str = this.getSqlStringValue(itemArray[c+1]);" ' ");" ' ");", ");int count = 0;for (int k = 0; k < CheckColumnList1.Items.Count ; k++)if (CheckColumnList1.GetItemCheckState(k) == CheckState.Checked)if (count == 2)" and ");if (count == 3)" and ");if (count == 4)" and ");if (count == 0)" where ");"[");"] = ");string str2 = this.getSqlStringValue(itemArray[k+1] );" ' ");" ' ");catch (Exception ex)MessageBox.Show(ex.Message, "Error Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);private void createUpdateStatementsForTable2()DataTable dt1 = new DataTable();"Update2");try{

Tr.AccessDiff1(txtfromserver.Text.Trim(), cmbfromdb.Text.Trim(), Frmtable1.Text.Trim(), txtuser1.Text.Trim(), txtpass1.Text.Trim(), txttoserver.Text.Trim(), cmbtodbname.Text.Trim(), Totable.Text.Trim(), txtuser2.Text.Trim(), txtpass2.Text.Trim(), ColumnList1.Text.Trim());

{


{
builder.Length = 0;
builder.Append(
builder.Append(Frmtable1.Text.Trim());
builder.Append(


{

{
builder.Append(
builder.Append(CheckColumnList1.Items[c]);
builder.Append(

builder.Append(
builder.Append(str);
builder.Append(
builder.Append(

}
}



{

{

{
builder.Append(
}

{
builder.Append(
}

{
builder.Append(
}

{
builder.Append(
}
builder.Append(
builder.Append(CheckColumnList1.Items[k]);
builder.Append(

builder.Append(
builder.Append(str2);
builder.Append(
count = 1;
count++;
}
}

dt1.Rows.Add(builder.ToString());

dtgridUpdateTable2.DataSource = dt1;

}
}
}

{

}
}



{

dtDelete1.Columns.Add(
TableComparer Tr = new TableComparer();if (Tr.DtR != null)StringBuilder builder = new StringBuilder(0x100);for (int i = 0; i < Tr.DtR.Rows.Count; i++)"update [");"] set ");object[] itemArray = Tr.DtR.Rows[i].ItemArray;for (int c = 0; c < CheckColumnList1.Items.Count; c++)if (CheckColumnList1.GetItemCheckState(c) == CheckState.Unchecked)"[");"] = ");string str = this.getSqlStringValue(itemArray[c + 1]);" ' ");" ' ");", ");int count = 0;for (int k = 0; k < CheckColumnList1.Items.Count; k++)if (CheckColumnList1.GetItemCheckState(k) == CheckState.Checked)if (count == 2)" and ");if (count == 3)" and ");if (count == 4)" and ");if (count == 0)" where ");"[");"] = ");string str2 = this.getSqlStringValue(itemArray[k + 1]);" ' ");" ' ");catch (Exception ex)MessageBox.Show(ex.Message, "Error Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);private void DeleteStatementForTable1()DataTable dtDelete1 = new DataTable();"Delete1");try{

Tr.AccessDiff1(txtfromserver.Text.Trim(), cmbfromdb.Text.Trim(), Frmtable1.Text.Trim(), txtuser1.Text.Trim(), txtpass1.Text.Trim(), txttoserver.Text.Trim(), cmbtodbname.Text.Trim(), Totable.Text.Trim(), txtuser2.Text.Trim(), txtpass2.Text.Trim(), ColumnList1.Text.Trim());



}

{


}









}








TableComparer Tr = new TableComparer();catch (Exception ex )throw;public enum ComparisonTypes{
Different = 8,
Identical = 1,
MissingFrom1 = 2,
MissingFrom2 = 4,
None = 0
}

{
}


}
}


DLL Page




using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Data;using System.Data.SqlClient;namespace
{
TableComparisonDLLpublic class TableComparer{






public String sConstring = null;public String ConnectionName = null;public SqlConnection oCon;public DataSet ds3, ds2;public SqlDataAdapter ad1, ad2;public SqlCommand cmd1, cmd2;DataTable Different1 = new DataTable();//private ToolTip _FieldTip = new ToolTip();






{
public DataTable DTRMissing1 = new DataTable();public DataTable DTRMissing2 = new DataTable();public DataTable DtR = new DataTable();public DataTable DtR1 = new DataTable();public DataTable DTRIDENTICAl = new DataTable(); public void AccessDiff1(String txtfromserver,String FromDb,String FromTable, String User1,String Password1,String ToServer,String ToDb,String ToTable,String User2,String Password2,String Columnlist1 )try{//dataGridView2.DataSource = "";//dataGridView1.DataSource = "";//datagridIdenticall.DataSource = "";//dataGridMissing1.DataSource = "";
//dataGridMissing2.DataSource = "";
string sCon;// sConstring = "Data Source=" + txtfromserver + " ;Initial Catalog=" + cmbfromdb.Text + " ;user=" + txtuser1.Text + ";password=" + txtpass1.Text + " ";// sCon = "Data Source=" + txttoserver.Text + " ;Initial Catalog= " + cmbtodbname.Text + ";Integrated Security=SSPI";sCon =


oCon =
oCon.ConnectionString = sCon;

oCon.Open();



oDatAdop1.Fill(odtSet1);




oDatAdop2.Fill(odtSet2);

DTRIDENTICAl = odtSet2.Tables[0];


"Data Source=" + txtfromserver.Trim() + " ;Initial Catalog=" + FromDb.Trim() + " ;user=" + User1.Trim() + ";password=" + Password1.Trim() + " ";new SqlConnection();if (oCon.State == ConnectionState.Closed)SqlDataAdapter oDatAdop1 = new SqlDataAdapter("select 1 as tablename ,* from ( select * from [" + txtfromserver.Trim() + "]." + FromDb.Trim() + ".dbo." + FromTable.Trim() + " with(nolock) except select * from [" + ToServer.Trim() + "]." + ToDb.Trim() + ".dbo." + ToTable.Trim() + " with(nolock) ) as x union all select 2 as tablename ,* from ( select * from [" + ToServer.Trim() + "]." + ToDb.Trim() + ".dbo." + ToTable.Trim() + " with(nolock) except select * from [" + txtfromserver.Trim() + "]." + FromDb.Trim() + ".dbo." + FromTable.Trim() + " with(nolock)) as y order by " + Columnlist1.Trim() + " ", oCon);DataSet odtSet1 = new DataSet();SqlDataAdapter oDatAdop2 = new SqlDataAdapter(" select * from [" + txtfromserver.Trim() + "]." + FromDb.Trim() + ".dbo." + FromTable.Trim() + " with(nolock) intersect select * from [" + ToServer.Trim() + "]." + ToDb.Trim() + ".dbo." + ToTable.Trim() + " with(nolock) order by " + Columnlist1.Trim() + " ", oCon);DataSet odtSet2 = new DataSet();// datagridIdenticall.DataSource = odtSet2.Tables[0];//DataTable DTRMissing1 = new DataTable();//DataTable DTRMissing2 = new DataTable();//DataTable DtR = new DataTable();
//DataTable DtR1 = new DataTable();





DtR.Columns.Clear();
DtR1.Columns.Clear();
DTRMissing2.Columns.Clear();
DTRMissing1.Columns.Clear();


{
DtR.Columns.Add(tt);
DtR1.Columns.Add(tt);
DTRMissing2.Columns.Add(tt);
DTRMissing1.Columns.Add(tt);
}

DataTable MissingFrom2 = new DataTable();string tablename = "";string worksetid = "";string Itable = "";string Iworkset = "";ComparisonResultsTable compr1 = new ComparisonResultsTable(odtSet1.Tables[0]);foreach (String tt in compr1.ColumnNames)//dataGridView2.DataSource = "";//dataGridView1.DataSource = "";
{

{

{
for (int i = 0; i < odtSet1.Tables[0].Rows.Count; i++)if (i > 0)if (tablename != odtSet1.Tables[0].Rows[i].ItemArray[0].ToString() && worksetid == odtSet1.Tables[0].Rows[i].ItemArray[1].ToString())// DataRow dr1 = odtSet1.Tables[0].Rows[i];
DataRow row = odtSet1.Tables[0].Rows[i];// DataRow dr2 = odtSet1.Tables[0].Rows[i-1];
Itable = row1.ItemArray[0].ToString();
Iworkset = row1.ItemArray[1].ToString();



DataRow row1 = odtSet1.Tables[0].Rows[i - 1];int j = row.ItemArray.Length;//dtDifferent1.Rows.Add(dr1.ItemArray[0], dr1.ItemArray[1], dr1.ItemArray[2], dr1.ItemArray[3], dr1.ItemArray[4], dr1.ItemArray[5], dr1.ItemArray[6]);
//dtdifferent2.Rows.Add(dr2.ItemArray[0], dr2.ItemArray[1], dr2.ItemArray[2], dr2.ItemArray[3], dr2.ItemArray[4], dr2.ItemArray[5], dr2.ItemArray[6]);
{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1]);
}


{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2]);
}


{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3]);
}

{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4]);
}

{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5]);
}

{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5], row1.ItemArray[6]);
}

{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5], row1.ItemArray[6], row1.ItemArray[7]);
}

{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5], row1.ItemArray[6], row1.ItemArray[7], row1.ItemArray[8]);
}

{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5], row1.ItemArray[6], row1.ItemArray[7], row1.ItemArray[8], row1.ItemArray[9]);
}

{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5], row1.ItemArray[6], row1.ItemArray[7], row1.ItemArray[8], row1.ItemArray[9], row1.ItemArray[10]);

}

{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5], row1.ItemArray[6], row1.ItemArray[7], row1.ItemArray[8], row1.ItemArray[9], row1.ItemArray[10], row1.ItemArray[11]);
}

{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5], row1.ItemArray[6], row1.ItemArray[7], row1.ItemArray[8], row1.ItemArray[9], row1.ItemArray[10], row1.ItemArray[11], row1.ItemArray[12]);

}

{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5], row1.ItemArray[6], row1.ItemArray[7], row1.ItemArray[8], row1.ItemArray[9], row1.ItemArray[10], row1.ItemArray[11], row1.ItemArray[12], row1.ItemArray[13]);
}

{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5], row1.ItemArray[6], row1.ItemArray[7], row1.ItemArray[8], row1.ItemArray[9], row1.ItemArray[10], row1.ItemArray[11], row1.ItemArray[12], row1.ItemArray[13], row1.ItemArray[14]);
}

{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5], row1.ItemArray[6], row1.ItemArray[7], row1.ItemArray[8], row1.ItemArray[9], row1.ItemArray[10], row1.ItemArray[11], row1.ItemArray[12], row1.ItemArray[13], row1.ItemArray[14], row1.ItemArray[15]);

}

{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5], row1.ItemArray[6], row1.ItemArray[7], row1.ItemArray[8], row1.ItemArray[9], row1.ItemArray[10], row1.ItemArray[11], row1.ItemArray[12], row1.ItemArray[13], row1.ItemArray[14], row1.ItemArray[15], row1.ItemArray[16]);
}


{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16], row.ItemArray[17]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5], row1.ItemArray[6], row1.ItemArray[7], row1.ItemArray[8], row1.ItemArray[9], row1.ItemArray[10], row1.ItemArray[11], row1.ItemArray[12], row1.ItemArray[13], row1.ItemArray[14], row1.ItemArray[15], row1.ItemArray[16], row1.ItemArray[17]);
}

{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16], row.ItemArray[17], row.ItemArray[18]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5], row1.ItemArray[6], row1.ItemArray[7], row1.ItemArray[8], row1.ItemArray[9], row1.ItemArray[10], row1.ItemArray[11], row1.ItemArray[12], row1.ItemArray[13], row1.ItemArray[14], row1.ItemArray[15], row1.ItemArray[16], row1.ItemArray[17], row1.ItemArray[18]);
}


{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16], row.ItemArray[17], row.ItemArray[18], row.ItemArray[19]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5], row1.ItemArray[6], row1.ItemArray[7], row1.ItemArray[8], row1.ItemArray[9], row1.ItemArray[10], row1.ItemArray[11], row1.ItemArray[12], row1.ItemArray[13], row1.ItemArray[14], row1.ItemArray[15], row1.ItemArray[16], row1.ItemArray[17], row1.ItemArray[18], row1.ItemArray[19]);
}


{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16], row.ItemArray[17], row.ItemArray[18], row.ItemArray[19], row.ItemArray[20]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5], row1.ItemArray[6], row1.ItemArray[7], row1.ItemArray[8], row1.ItemArray[9], row1.ItemArray[10], row1.ItemArray[11], row1.ItemArray[12], row1.ItemArray[13], row1.ItemArray[14], row1.ItemArray[15], row1.ItemArray[16], row1.ItemArray[17], row1.ItemArray[18], row1.ItemArray[19], row1.ItemArray[20]);
}

{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16], row.ItemArray[17], row.ItemArray[18], row.ItemArray[19], row.ItemArray[20], row.ItemArray[21]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5], row1.ItemArray[6], row1.ItemArray[7], row1.ItemArray[8], row1.ItemArray[9], row1.ItemArray[10], row1.ItemArray[11], row1.ItemArray[12], row1.ItemArray[13], row1.ItemArray[14], row1.ItemArray[15], row1.ItemArray[16], row1.ItemArray[17], row1.ItemArray[18], row1.ItemArray[19], row1.ItemArray[20], row1.ItemArray[21]);
}

{
DtR.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16], row.ItemArray[17], row.ItemArray[18], row.ItemArray[19], row.ItemArray[20], row.ItemArray[21], row.ItemArray[22]);
DtR1.Rows.Add(row1.ItemArray[0], row1.ItemArray[1], row1.ItemArray[2], row1.ItemArray[3], row1.ItemArray[4], row1.ItemArray[5], row1.ItemArray[6], row1.ItemArray[7], row1.ItemArray[8], row1.ItemArray[9], row1.ItemArray[10], row1.ItemArray[11], row1.ItemArray[12], row1.ItemArray[13], row1.ItemArray[14], row1.ItemArray[15], row1.ItemArray[16], row1.ItemArray[17], row1.ItemArray[18], row1.ItemArray[19], row1.ItemArray[20], row1.ItemArray[21], row1.ItemArray[22]);
}

if (j == 2)else if (j == 3)else if (j == 4)else if (j == 5)else if (j == 6)else if (j == 7)else if (j == 8)else if (j == 9)else if (j == 10)else if (j == 11)else if (j == 12)else if (j == 13)else if (j == 14)else if (j == 15)else if (j == 16)else if (j == 17)else if (j == 18)else if (j == 19)else if (j == 20)else if (j == 21)else if (j == 22)else if (j == 23)// dataGridView2.DataSource = DtR;// dataGridView1.DataSource = DtR1;}else{
tablename = odtSet1.Tables[0].Rows[i].ItemArray[0].ToString();
worksetid = odtSet1.Tables[0].Rows[i].ItemArray[1].ToString();







{

{
DataRow row = odtSet1.Tables[0].Rows[i - 1];int j = row.ItemArray.Length;if (Iworkset != row.ItemArray[1].ToString())if (row.ItemArray[0].ToString() == "1")// dtmissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6]);
{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1]);
}

{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2]);
}


{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3]);
}

{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4]);
}

{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5]);
}

{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6]);
}

{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7]);
}

{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8]);
}

{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9]);
}

{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10]);
}

{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11]);
}


{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12]);
}

{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13]);
}

{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14]);
}

{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15]);
}

{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16]);
}


{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16], row.ItemArray[17]);
}

{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16], row.ItemArray[17], row.ItemArray[18]);
}

{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16], row.ItemArray[17], row.ItemArray[18], row.ItemArray[19]);
}

{
DTRMissing2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16], row.ItemArray[17], row.ItemArray[18], row.ItemArray[19], row.ItemArray[20]);
}
if (j == 2)else if (j == 3)else if (j == 4)else if (j == 5)else if (j == 6)else if (j == 7)else if (j == 8)else if (j == 9)else if (j == 10)else if (j == 11)else if (j == 12)else if (j == 13)else if (j == 14)else if (j == 15)else if (j == 16)else if (j == 17)else if (j == 18)else if (j == 19)else if (j == 20)else if (j == 21)// dataGridMissing2.DataSource = DTRMissing2;}else{

// DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6]);
{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1]);
}

{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2]);
}


{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3]);
}

{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4]);
}

{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5]);
}

{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6]);
}

{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7]);
}

{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8]);
}

{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9]);
}

{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10]);
}

{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11]);
}


{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12]);
}

{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13]);
}

{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14]);
}

{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15]);
}

{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16]);
}


{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16], row.ItemArray[17]);
}

{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16], row.ItemArray[17], row.ItemArray[18]);
}


{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16], row.ItemArray[17], row.ItemArray[18], row.ItemArray[19]);
}


{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16], row.ItemArray[17], row.ItemArray[18], row.ItemArray[19], row.ItemArray[20]);
}

{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16], row.ItemArray[17], row.ItemArray[18], row.ItemArray[19], row.ItemArray[20], row.ItemArray[21]);
}

{
DTRMissing1.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4], row.ItemArray[5], row.ItemArray[6], row.ItemArray[7], row.ItemArray[8], row.ItemArray[9], row.ItemArray[10], row.ItemArray[11], row.ItemArray[12], row.ItemArray[13], row.ItemArray[14], row.ItemArray[15], row.ItemArray[16], row.ItemArray[17], row.ItemArray[18], row.ItemArray[19], row.ItemArray[20], row.ItemArray[21], row.ItemArray[22]);
}
if (j == 2)else if (j == 3)else if (j == 4)else if (j == 5)else if (j == 6)else if (j == 7)else if (j == 8)else if (j == 9)else if (j == 10)else if (j == 11)else if (j == 12)else if (j == 13)else if (j == 14)else if (j == 15)else if (j == 16)else if (j == 17)else if (j == 18)else if (j == 19)else if (j == 20)else if (j == 21)else if (j == 22)else if (j == 23)// dataGridMissing1.DataSource = DTRMissing1;}

}

}
}
else{
tablename = odtSet1.Tables[0].Rows[i].ItemArray[0].ToString();
worksetid = odtSet1.Tables[0].Rows[i].ItemArray[1].ToString();
}
}
}

{

}
catch (Exception ex)throw ex;finally{
oCon.Close();
}




}
}
}


sub DLL pages


using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Data;namespace
{
TableComparisonDLLpublic class ComparisonResultsTable{



public string[] ColumnNames;public Type[] ColumnTypes;internal bool[] ValueShouldBeQuoted;public int[] PrimaryKeyOrdinals;//public List<ComparisonResultsTableRow> Rows;
DataTable dt = new DataTable();//public DataTable dt3 = new DataTable();
{
public ComparisonResultsTable(DataTable schemaTable)try{




{



}


{

}
this.ColumnNames = new string[schemaTable.Columns.Count];this.ColumnTypes = new Type[schemaTable.Columns.Count];this.ValueShouldBeQuoted = new bool[schemaTable.Columns.Count];for (int i = 0; i < schemaTable.Columns.Count; i++)this.ColumnNames[i] = schemaTable.Columns[i].ColumnName;this.ColumnTypes[i] = schemaTable.Columns[i].DataType;this.ValueShouldBeQuoted[i] = ((schemaTable.Columns[i].DataType == typeof(string)) || (schemaTable.Columns[i].DataType == typeof(DateTime))) || (schemaTable.Columns[i].DataType == typeof(Guid));this.PrimaryKeyOrdinals = new int[schemaTable.PrimaryKey.Length];for (int j = 0; j < schemaTable.PrimaryKey.Length; j++)this.PrimaryKeyOrdinals[j] = schemaTable.PrimaryKey[j].Ordinal;//this.Rows = new List<ComparisonResultsTableRow>(10000);}

{

}
}
}
}
catch (Exception ex)throw ex;
Another SUb DLL Page


using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace
{
TableComparisonDLLpublic class ComparisonResultsTableRow{



{
public object[] ItemArray;public int[] OrdinalsForDifferentColumns;public ComparisonResultsTableRow(object[] itemArray)try{

}

{

}
}

{
this.ItemArray = itemArray;catch (Exception ex)throw ex;public ComparisonResultsTableRow(object[] itemArray, int[] ordinalsForDifferentColumns)try{


}

{

}
}

}
}
this.ItemArray = itemArray;this.OrdinalsForDifferentColumns = ordinalsForDifferentColumns;catch (Exception ex)throw ex;


private void Frmtable1_SelectedIndexChanged(object sender, EventArgs e)

Comments