Problem :
When I was executing a stored procedure in a SQL Server 2005 Database from my C# application, it gave me an error and here is the result I saw when I was debug it..

Image 1 : Exception Message
SQL Server blocked access to procedure ‘sys.sp_OACreate’ of component ‘Ole Automation Procedures’ because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of ‘Ole Automation Procedures’ by using sp_configure. For more information about enabling ‘Ole Automation Procedures’, see “Surface Area Configuration” in SQL Server Books Online.
And also I got below error messages with this error. I did not include all information of that message because it is too long..
SQL Server blocked access to procedure ‘sys.sp_OASetProperty’ of component ‘Ole Automation Procedures’ because this component is turned off as part of the security configuration for this server…
SQL Server blocked access to procedure ‘sys.sp_OAMethod’ of component ‘Ole Automation Procedures’ because this component is turned off as part of the security configuration for this server…
SQL Server blocked access to procedure ‘sys.sp_OADestroy’ of component ‘Ole Automation Procedures’ because this component is turned off as part of the security configuration for this server…
Then I searched solutions to fix this error and I found the solution.
Solution :
According to the message we have to enable the OLE Automation feature in Surface area configuration.
Here are steps to Enable the feature..

Image 2 : Search -> SQL Server Surface Area Configuration in Start menu

Image 3 : Select and click Surface Area Configuration for Features
Then you will enter to another form which contains features. Then Select “OLE Automation”

Image 4 : Select OLE Automation

Image 5 : Check the Enable OLE Automation Check box
Then Click “OK”, And Click “Apply”.
But when I click “OK”, I got another error that..
User does not have permission to perform this action.
You don’t have permission to RECONFIGURE statement.

Image 6 : Permission error
To fix this error, I had to give permission to the user..

Image 7 : Give permission to the user
Then you can apply OLE Automation Feature..
Thanks !
Great
LikeLiked by 1 person