I need to a Select Data from tables accessable via ODBC DSN and bring the result set/DataReader in SQL Server Via CLR Stored Procedure. So I wrote C# Program to create CLR Procdure for that.
As i built and Deploy the Procedure it deployees sucessfully but , in SQL Server Management Studio it gives System.Data.Odbc.OdbcPermi
ssion error while Executing procedure.
Code I am using is (is also working in independant C# application) is attahed
The code Builds and Executes as C# Application but when used in C# Database Project in StoredProcedure Class it builds and deployes but on execution of Stored Procedure from SQL Server Managemen Studio it returns Error
A .NET Framework error occurred during execution of user-defined routine or aggregate "spTestProcsAB":
System.Security.SecurityEx
ception: Request for the permission of type 'System.Data.Odbc.OdbcPerm
ission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c56193
4e089' failed.
System.Security.SecurityEx
ception:
at System.Security.CodeAccess
SecurityEn
gine.Check
(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.Permission
Set.Demand
()
at System.Data.Common.DbConne
ctionOptio
ns.DemandP
ermission(
)
at System.Data.Odbc.OdbcConne
ction.Perm
issionDema
nd()
at System.Data.Odbc.OdbcConne
ctionFacto
ry.Permiss
ionDemand(
DbConnecti
on outerConnection)
at System.Data.ProviderBase.D
bConnectio
nClosed.Op
enConnecti
on(DbConne
ction outerConnection, DbConnectionFactory connectionFactory)
at System.Data.Odbc.OdbcConne
ction.Open
()
at StoredProcedures.spTestPro
csAB()
Sample Project files are also attached you might need to setup ODBC USer DSN linking to MS Access file and Set Connection string of Database Project
Start Free Trial