zoukankan      html  css  js  c++  java
  • ReportViewer控件Local Mode下引用自定义程序集访问数据库引发无权限异常的解决方法.

    异常

    ==========================

    用户代码未处理 System.Security.SecurityException

      Message="请求“System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089”类型的权限已失败。"

      Source="mscorlib"

      StackTrace:

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

           在 System.Security.PermissionSet.Demand()

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

           在 System.Data.SqlClient.SqlConnection.PermissionDemand()

           在 System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection outerConnection)

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

           在 System.Data.SqlClient.SqlConnection.Open()

           在 RptExtension.Class1.test(String t)

           在 ReportExprHostImpl.Aggregate0_AggregateParamExprHost.get_ValueExpr()

           在 Microsoft.ReportingServices.ReportProcessing.ReportRuntime.EvaluateAggregateVariantOrBinaryParamExpr(DataAggregateInfo aggregateInfo, Int32 index, IErrorContext errorContext)

      InnerException: 

    ====解决方法

    reportViewer.LocalReport.ExecuteReportInCurrentAppDomain(System.Reflection.Assembly.GetExecutingAssembly().Evidence); 

    ----------------------------------- http://www.cnblogs.com/rock_chen/
  • 相关阅读:
    数据库相关(转)
    sql之left join、right join、inner join的区别
    PHP面试编程
    实验6 shell程序设计一(1)
    实验7 shell程序设计二(1)
    Linux软件安装管理
    Linux常用命令总结
    合唱团
    linux课后作业1
    linux网络服务实验
  • 原文地址:https://www.cnblogs.com/rock_chen/p/1513476.html
Copyright © 2011-2022 走看看