How can an error be solved: "Could not find the installable ISAM file?

0

   public static void ROC_ExcelToDatagridView (DataGridView dgv)
        {
        path = "";
        try
            {
            try
                {
                 OpenFileDialog file = new OpenFileDialog ( );
                 file.Filter = "Excel Files |*.xlsx";
                 file.Title = "Seleccione el Archivo de Excel";

            if (file.ShowDialog ( ) == DialogResult.OK)
                {
                if (file.FileName.Equals ( "" ) == false)
                    {
                    path = file.FileName;
                    }
                   }
                    hoja = Microsoft.VisualBasic.Interaction.InputBox 
            ("Escriba el nombre de la hoja!", "Excel a Datagridview" );
           string conexion = @"Provider=Microsoft.ACE.OLEDB.12.0; Data 
        [![introducir la descripción de la imagen aquí][1]][1]Source:" + path + ";Extended Properties='Excel 12.0 Xml;HDR=Yes'";
            oCon = new OleDbConnection ( conexion );
            oCon.Close ( );
            oCon.Open ( );
            oda = new OleDbDataAdapter ( "Select * from [" + hoja + "$] where Fecha is not null and Importado is null", oCon );
            dt = new DataTable ( );
            oda.Fill ( dt );
            dgv.DataSource = dt;
            oCon.Close ( );
                }
            catch (OleDbException e)
                {
                MessageBox.Show ( "ERROR: " + hoja + " "+ path +" "+ e.Message);
                }
            }
        catch (Exception ex)                                                                                                                                                     
            {
            MessageBox.Show ( "Error al momento de cargar los datos del Excel de la hoja " + hoja + " "+ path +" a la tabla del formulario. " + ex.Message + " " + ex.ToString ( ), "ERROR DE CARGA", MessageBoxButtons.OK, MessageBoxIcon.Error );
            }
        }

    }
}
    
asked by cris guerrero flores 13.10.2018 в 00:04
source

1 answer

0

I do not know if it's going to work:

To resolve this problem, delete the new parameters in the connection string. To do this, follow these steps:

  • Open the Excel workbook.

  • On the data ribbon, click on the connections button.

  • In the Book Connections dialog box, select the connection to the Access database, and then click Properties.

  • In the Connection Properties dialog box, click the definition tab.

  • Remove the following parameters from the connection string:

    • Jet OLEDB: Bypass UserInfo validation = False;

    • OLEDB caching: Limited Jet DB = False;

    • Jet OLEDB: Bypass discriminant validation = False

  • In the Connection Properties dialog box, click OK. At this point, the data should be updated.

  • In the Book Connections dialog box, click Close, and then save the updated book.

link

    
answered by 14.10.2018 в 20:14