I have the following conflict, by means of several objects and queries I am consulting 4 different databases that together load information with a DataGrid
, this DataGrid
in turn must feed To another table with the information it contains, the problem is when I try to compare the content of the grid with a DataTable
that queries the final table that should store the information of the grid , Who gives me an idea of how to make such a comparison? Thanks for your valuable help.
/*Variables Globales*/
bool existe = false;
string fechaI = dtpInicial.Value.ToString("yyyy-MM-dd");
string fechaF = dtpFinal.Value.ToString("yyyy-MM-dd");
string estaciones = cmbEstacion.SelectedValue.ToString().Substring(0, cmbEstacion.SelectedValue.ToString().IndexOf('~'));
/*Objetos*/
Datos.Corresponsalia objCorresponsalia = new Datos.Corresponsalia();
DataTable dtCorresponsalias = new DataTable();
dtCorresponsalias = objCorresponsalia.ConsultaCorresponsalia(fechaI, fechaF, estaciones);
if (dtCorresponsalias==dgvRegistros.DataSource)
{
existe = true;
if (existe)
{
objCorresponsalia.BorrarDuplicados(fechaI, fechaF, estaciones);
}
else
{
if (dgvRegistros.Rows.Count > 0)
{
foreach (DataGridViewRow row in dgvRegistros.Rows)
{
objCorresponsalia.InsertaFilasDataGrid(fechaI, fechaF, estaciones);
objValidacion.MostrarAviso("Cargando registros en la Base de Datos por favor espere un Momento", false, lblAviso);
}
objValidacion.MostrarAviso("Carga exitosa en la Base de Datos", false, lblAviso);
}
else
{
objValidacion.MostrarAviso("No se encontraron registros para guardar", true, lblAviso);
}
}
}
}