C1.C1Excel replace OLEDB ACE generation for Excel xls files?

Posted by: enrique.pv-ext on 3 November 2026, 12:03 pm EST

  • Posted 3 November 2026, 12:03 pm EST

    hi misters

    hoW-TO replace OLEDB ACE for use your C1.Excel control ?

           connection = BaseCode.Helpers.ExcelOleDbHelper.CreateConnection(directory + filename);
           connection.Open();
           cmd = new OleDbCommand();
           cmd.Connection = connection;

    using C1.C1Excel (ComponentOne) │

    licenses.licx and C! controls in the project

    check C1Excel.

    thanks!

  • Posted 4 November 2026, 2:00 am EST

    Hello Enrique,

    ‘OLE DB/ACE’ treats Excel worksheets like database tables and allows SQL-style queries through ‘OleDbConnection’ and ‘OleDbCommand’.

    ‘C1Excel’, on the other hand, works directly with Excel workbooks, worksheets, rows, columns, and cells. It is useful when you need to read, create, or modify Excel files without relying on the ACE provider.

    Since ‘C1Excel’ is not a direct replacement for ‘OleDbConnection’, could you please share your exact use case and the code you execute after opening the connection? Based on that, we can confirm whether C1Excel can be used for your scenario.

    C1Excel: https://developer.mescius.com/componentone/docs/win/online-excel/overview

    Regards,

    Uttkarsh

  • Posted 4 November 2026, 3:18 am EST

    Yeah, we should thinking about migrate to avoid use ACE OLEDB.

    C1Excel is like EPPlus library ? o NOPI..

    code for migrate:

          OleDbConnection connection = null;
          OleDbCommand cmd = null;
    
          int errorCount = 0;
          try
          {
              DataTable dt = new DataTable();
              if (File.Exists(directory + filename))
              {
                  File.Delete(directory + filename);
              }
    
              connection = BaseCode.Helpers.ExcelOleDbHelper.CreateConnection(directory + filename);
              connection.Open();
              cmd = new OleDbCommand();
              cmd.Connection = connection;
    
              dt = getTempTable(queryWhere);
    
              DataRow drow = dt.NewRow();
    
              totalRows = dt.Rows.Count;
              subTables = (int)System.Math.Ceiling((double)totalRows / 65500);
    
              if (subTables == 0) { subTables++; }
    
              partialRowsBegin = new int[subTables];
              partialRowsEnd = new int[subTables];
    
              cont = totalRows / subTables;
    
              partialRowsBegin[0] = 0;
              partialRowsEnd[partialRowsBegin.Length - 1] = totalRows;
    
              for (int i = 1; i < subTables; i++)
              {
                  partialRowsBegin[i] = (cont * i) + 1;
              }
    
              for (int i = 0; i < subTables - 1; i++)
              {
                  partialRowsEnd[i] = cont * (i + 1) + 1;
              }
    
              if (subTables == 0) { subTables = 0; }
    
              #region CODIGO EXCEL 2003 SE PAGINAN LOS REGISTROS
              for (idxSubTables = 0; idxSubTables < subTables; idxSubTables++)
              {
                  #region CREATE EXCEL TABS
                  cmd.CommandText = string.Format(@"CREATE TABLE [LIQUIDATIONS_{0}] (
                                                          [" + C1GridView1.Columns[(int)ColumnsC1GridView1.DATE].HeaderText + @"] string, 
                                                          [" + C1GridView1.Columns[(int)ColumnsC1GridView1.PLACE].HeaderText + @"] string, 
                                                          [" + C1GridView1.Columns[(int)ColumnsC1GridView1.OPERATOR].HeaderText + @"] string,
                                                          [" + C1GridView1.Columns[(int)ColumnsC1GridView1.AMOUNT_TAB].HeaderText + @"] string,
                                                          [" + C1GridView1.Columns[(int)ColumnsC1GridView1.AMOUNT_VALIDATED].HeaderText + @"] string,
                                                          [" + C1GridView1.Columns[(int)ColumnsC1GridView1.AMOUNT_RECHARGES].HeaderText + @"] string,
                                                          [" + C1GridView1.Columns[(int)ColumnsC1GridView1.AMOUNT_WITHDRAWALS].HeaderText + @"] string,
                                                          [" + C1GridView1.Columns[(int)ColumnsC1GridView1.AMOUNT_LIQUIDATED].HeaderText + @"] string,
                                                          [" + C1GridView1.Columns[(int)ColumnsC1GridView1.AMOUNT_COUNTED].HeaderText + @"] string,
                                                          [" + C1GridView1.Columns[(int)ColumnsC1GridView1.OPERATOR_DEBT].HeaderText + @"] string
                                                          )", idxSubTables);
    
                  // --[DETRACCION] string,
                  cmd.ExecuteNonQuery();
                  #endregion
    
                  for (idxRows = partialRowsBegin[idxSubTables]; idxRows < partialRowsEnd[idxSubTables]; idxRows++)
                  {
    
    ...
    
        if (errorCount > 0)
        {
            cmd.CommandText = @"CREATE TABLE [Errores] ([Nº Errores] string)";
            cmd.ExecuteNonQuery();
    
            string sql = string.Format(@"INSERT INTO [Errores] ([Nº Errores]) VALUES ('{0}')", errorCount);
            cmd.CommandText = sql;
            cmd.ExecuteNonQuery();
        }
  • Posted 4 November 2026, 9:20 am EST

    Hello Enrique,

    Thank you for sharing the code. Your use case is clearer now.

    Yes, C1Excel is conceptually similar to libraries such as EPPlus or NPOI. Instead of treating Excel as a database using OleDbCommand, you work directly with a workbook, worksheets, and cells.

    In your current code, for example:

    • CREATE TABLE [LIQUIDATIONS_0] creates an Excel worksheet.
    • INSERT INTO … adds data to that worksheet.

    With C1Excel, the equivalent approach would be to create an C1XLBook, add a worksheet for each LIQUIDATIONS_x section, write the column headers and DataTable values directly into cells, and then save the workbook as an .xls file.

    C1Excel supports creating and saving .xls workbooks without requiring the ACE OLEDB provider.

    Please refer to the attached sample for your reference. (see ExcelExport_Sample.zip)

    Regards,

    Uttkarsh.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels