none
Error when trying to connect to SQL Server Database from Excel RRS feed

  • Question

  • I am getting this error when I try to create a connection to a SQL Server database from Excel. I found a reference online that mentioned this Forum but please redirect me if this is incorrect.

    Details: "An error happened while reading data from the provider: 'Could not load file or assembly 'System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Either a required impersonation level was not provided, or the provided impersonation level is invalid. (Exception from HRESULT: 0x80070542)'"

    I previously got this error when trying to use Power BI Desktop, but after resetting my PC I was finally able to connect. I'm still seeing the error with Excel. If I run Excel as an Administrator, I can connect to the database, but that is not practical in my environment.

    Any ideas on how to fix this?

    Michael

    Thursday, April 4, 2019 6:17 PM

All replies

  • Hi Michael,

    Welcome to the MSDN forum.

    Now if you use the Power BI desktop (sign in with the normal account not the Administrator) to connect the SQL Server Database, does this error persists or not?

    According to the error message, some community members solved by launching as an administrator and establishing the connection, the required DLLs are registered properly. After that, launching it as a normal account also works fine.

    If the above method not works, please have a try with the following:

    1. Please repair your .NET Framework, restart your server and try again to see if it works.
    2. Check the folder: C:\Windows\Microsoft.NET\assembly\GAC_32\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50a3a, if it is empty, copy these two dlls: System.EnterpriseServices.dll/ System.EnterpriseServices.Wrapper.dll into this folder. If not, register those dlls again
    3. Open the CMD and run the command: sfc /scannow to scan the system file and fix some corrupted or missing file once it found

    Best regards,

    Sara


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Friday, April 5, 2019 2:08 AM
    Moderator
  • I've tried everything, but to no avail. One additional piece of information - I can use an odc file created previously to open up a connection to a SQL Server database. I'm just not able to create a new odc connection.

    Michael


    Michael Shay

    Thursday, June 6, 2019 7:12 PM