【发布时间】:2016-01-13 14:45:30
【问题描述】:
我在 crm 插件中编写此查询,但出现此错误
我在 crm 数据库中创建了这个视图(vwPayrollEmployees)
请求类型的许可 'System.Data.SqlClient.SqlClientPermission, System.Data, 版本=4.0.0.0,文化=中性,PublicKeyToken=b77a5c561934e089' 失败
SqlConnection myConnection = new SqlConnection("Data Source=........;Initial Catalog=......;Persist Security Info=True;User ID=sa;Password=.......;");
SqlCommand myCommand = new SqlCommand("[Depart]FROM [mbm_MSCRM].[dbo].[vwPayrollEmployees] WHERE [mbmhr_EmployeeNbr] =@EmpNbr", myConnection);
myCommand.Parameters.Add("@EmpNbr", empnbr);
myCommand.Connection = myConnection;
myConnection.Open();
SqlDataReader myReader = myCommand.ExecuteReader();
while (myReader.Read())
{
vdep = myReader["[Depart]"].ToString();
}
myConnection.Close();
【问题讨论】:
标签: c# plugins crm dynamics-crm-2015