Error: The type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception
Issue
When user a 'Dynamics NAV 2013 and later (SQL Server)' data source in the Jet Excel Add-In, a non-admin user can receive the following error:
Complete text of error message is:
An unexpected error has occurred: The type initializerĀ for 'System.Data.SqlClient.SqlConnection' threw an exception.
Cause
Non-admin user accounts need to be assigned to the "Impersonate a client after authentication" security policy role to allow the Jet Excel Add-In to access data directly from a SQL database.
Resolution
Here are the steps that a LOCAL ADMINISTRATOR will need to follow to add the non-admin user to this role:
-
From the Windows Start menu, search for Administrative Tools and click Administrative Tools.
-
Double-click Local Security Policy.
-
Expand Local Policies, and then click User Rights Assignment.
-
In the right pane, double-click Impersonate a client after authentication.
-
In the Local Security Policy Setting dialog box, click Add User or Group.
-
In the Select Users or Group dialog box, find the user account that you want to add, then click OK.
Click OK onĀ the Local Security Policy Setting dialog box.
Reboot the system and try the steps to reproduce the problem.