i write this query in a crm plugin but i get this error
Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed
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();
i create this view (vwPayrollEmployees) in crm database
*This post is locked for comments
I have the same question (0)