Example #1
0
        private void btnGenerar_Click(object sender, EventArgs e)
        {
            try
            {
                if (!ValidarSeleccion())
                {
                    return;
                }
                progressBar1.Value = 50;
                //Recupera datos de excel
                Excel objExc = new Excel();
                if (!objExc.CargarArchivo(txtRutaArchivo.Text.Trim(), cbHojaExcel.Text.Trim()))
                {
                    MessageBox.Show(objExc.Error, "AVISO", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    progressBar1.Value = 100;
                    objExc             = null;
                    return;
                }
                DataTable tb = objExc.tablita;
                objExc = null;

                //Crea la tabla y realcionar y hacer la consulta
                ConexionSQLite objSQLite = new ConexionSQLite();
                if (!objSQLite.GenerarDataMarestra(tb, this.tvTablas.SelectedNode.Text, this.dgvDatos))
                {
                    MessageBox.Show(objSQLite.Error, "AVISO", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    progressBar1.Value = 100;
                    objSQLite          = null;
                    return;
                }
                objSQLite = null;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message, "AVISO", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }