我有使用外部程序集的rdlc报告,自定义程序集有连接字符串定义但是我在运行报告时无法打开连接字符串这里到目前为止我做了什么:
这是我在自定义程序集中的代码:
public string GradeCal(int SubjDivID, decimal Perc)
{
Bll_BlockPlan ObjClass = new Bll_BlockPlan();
SqlConnection oConn = new SqlConnection();
oConn.ConnectionString = "Data Source=******;Initial Catalog=PSIDB_Test; User ID=sa; Password=*****;Persist Security Info=True";
try
{
oConn.Open();
}
catch(Exception ex)
{
string msg = ex.Message;
}
SqlCommand oCmd = new SqlCommand();
oCmd.Connection = oConn;
oCmd.CommandText = "Select V.Title as Grade From (Select *, IsNull(Lead(Percentage) Over (Order By Percentage),(Select Max(Percentage)+.01 From LP_SubjectDivisionsGrades WHERE SubjectDivisionsID = @SubDivID)) NextPercentage From LP_SubjectDivisionsGrades where SubjectDivisionsID = @SubDivID) G inner join LP_SubjectGrades v on v.id = g.GradeID where @Perc >= G.Percentage And @Perc < G.NextPercentage";
oCmd.Parameters.AddWithValue("@SubDivID", SubjDivID);
oCmd.Parameters.AddWithValue("@Perc", Perc);
string nRetVal = oCmd.ExecuteScalar().ToString();
return nRetVal;
}
自定义程序集类中的例外是:
请求类型'System.Data.SqlClient.SqlClientPermission,System.Data,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'的权限失败。
请不要知道我在哪里设置权限data.sqlclient ??
请帮助我