Problem with using access, Retrieving the COM class factory for component

1

I want to add a list of data to an Access Database I run it on 2 machines this both machines are Windows 10, 64bit and on both I installed Office 365 MSO (16.0.11029.20104) 64-bit

On one machine it runs fine, On the other one I got this Error

I got the next Exception

Retrieving the COM class factory for component with CLSID {CD7791B9-43FD-42C5-AE42-8DD2811F0419} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

on this code

DAO.DBEngine dbEngine = new DAO.DBEngine();

On this line of code

public void AddBarcodes15(List<Barcode> barcodes)
        {
            try
            {
                DateTime start = DateTime.Now;
                DAO.DBEngine dbEngine = new DAO.DBEngine();
                DAO.Database db = dbEngine.OpenDatabase(databaseName);

                DAO.Recordset rs = db.OpenRecordset("bar_code_parmter_15");

                DAO.Field[] myFields = new DAO.Field[7];

                myFields[0] = rs.Fields["num"];
                myFields[1] = rs.Fields["BarCode"];
                myFields[2] = rs.Fields["date_Formation"];
                myFields[3] = rs.Fields["test_BaseDay"];
                myFields[4] = rs.Fields["project"];
                myFields[5] = rs.Fields["NumTest"];
                myFields[6] = rs.Fields["gggggg"];

                for (int i = 0; i < barcodes.Count; i++)
                {
                    Barcode b = barcodes[i];
                    rs.AddNew();
                    myFields[0].Value = b.num;
                    myFields[1].Value = b.BarCode;
                    myFields[2].Value = b.date_Formation;
                    myFields[3].Value = b.test_BaseDay;
                    myFields[4].Value = b.project;
                    myFields[5].Value = b.NumTest;
                    myFields[6].Value = b.gggggg;
                    rs.Update();
                }
                rs.Close();
                db.Close();
            }
            catch (Exception ex)
            {
                WriteLog(ex.StackTrace, ex.Message);
                throw ex;
            }
        }
c#
access
asked on Stack Overflow Dec 31, 2018 by jon

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0