From: RFS on
I have a store procedure written in VB.NET to access an AS400 using
System.Data.OleDb. I set the assmbly as EXTERNAL ACCESS and created the key
for the procedure as a .pfx file. Before adding the code to access the
AS400, I tested it against a SQL Server database and it worked fine. When I
added the code to access the AS400, I get the following error:

A .NET Framework error occurred during execution of user defined routine or
aggregate 'ap_mapics_Data':

System.Security.SecurityException: Request for the permission of type
'System.Data.OleDb.OleDbPermission, System.Data, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

System.Security.SecurityException:

at System.Security.CodeAccessSecurityEngine.Check(Object demand,
StackCrawlMark& stackMark, Boolean isPermSet)

at System.Security.PermissionSet.Demand()

at System.Data.Common.DbConnectionOptions.DemandPermission()

at System.Data.OleDb.OleDbConnection.PermissionDemand()

at System.Data.OleDb.OleDbConnectionFactory.PermissionDemand(DbConnection
outerConnection)

at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory)

at System.Data.OleDb.OleDbConnection.Open()

at ProImage_Procedures_Test.StoredProcedures.ap_mapics_Data()