Deepanshu Mehta

Deepanshu Mehta

  • NA
  • 33
  • 2.6k

how to compare two .DBF files and result in third.

Aug 17 2017 9:28 PM
Hi, i have to compare two .DBF files for the same row data, different row data and missing data and shows the result in third file. The code would locate the each row of file1 in file2 with the first collumn value. if the row found then it compare the value of each collumn for that row and shows 'pass' in third file if it matches for that row. if it does not macthes, then it shows 'fails'  for that particular row. if the row is missing in the file2, then it says 'data missing'.
i have tried few codes but it did not work out. does anybody have code for this. 
 
i am currently trying with this code.
 
public void button1_Click(object sender, EventArgs e)
{
FolderBrowserDialog d = new FolderBrowserDialog();
d.SelectedPath = textBox1.Text;
DialogResult result = d.ShowDialog();
if (result.Equals(DialogResult.OK) || result.Equals(DialogResult.Yes))
{
textBox1.Text = d.SelectedPath;
ReadMasterDBFS();
}
}
public void ReadMasterDBFS()
{
string sPath;
sPath = textBox1.Text;
if (sPath == "")
{
return;
}
DBFReader r = new DBFReader(sPath, "MASTER");
DataTable dt = r.Read();
if (dt == null)
{
return;
}
}
private void button2_Click(object sender, EventArgs e)
{
FolderBrowserDialog f = new FolderBrowserDialog();
f.SelectedPath = textBox1.Text;
DialogResult result = f.ShowDialog();
if (result.Equals(DialogResult.OK) || result.Equals(DialogResult.Yes))
{
textBox2.Text = f.SelectedPath;
ReadMasterDBFT();
}
}
public void ReadMasterDBFT()
{
string tPath;
tPath = textBox2.Text;
if (tPath == "")
{
return;
}
DBFReader s = new DBFReader(tPath, "MASTER");
DataTable dtt = s.Read();
if (dtt == null)
{
return;
}
}
private void button3_Click(object sender, EventArgs e)
{
DataTable table = new DataTable[“Report”];
DBFReader r = new DBFReader(sPath, "MASTER");
DataTable dt = r.Read();
DBFReader s = new DBFReader(tPath, "MASTER");
DataTable dtt = s.Read();
if (dt.Rows.Count != dtt.Rows.Count || dt.Columns.Count != dtt.Columns.Count)
{
table.rows.add( 'pass');
}
else {
for (int i = 0; i < dt.Rows.Count; i++)
{
for (int c = 0; c < dtt.Columns.Count; c++)
{
if (!Equals(dt.Rows[i][c], dtt.Rows[i][c]))
;
}
}
 
 

Answers (2)