locked
SQL Connection in Code Behind..Getting Request for the permission of type System.Data.SqlClient Error RRS feed

  • Question

  • Hey,

    I have the following connection set in the code editor

    SqlConnection

    conn = new SqlConnection("server=SF2011;database=Vision_Local;Integrated Security=FALSE;user=sa;pwd=user2011;MultipleActiveResultSets=True;");

    ..

    conn.Open();

    But getting the following error when run.

    Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

    On the line

    conn.Open();

    Any Ideas ?

    Thursday, December 29, 2011 10:27 PM

Answers

  • Hi Velnias:

     

    It is a permissions issue,In Visual Studio,you can try to :

    Project->properties->security tab->select "full trust application"

     

    For more information ,please refer to this site:

    http://msdn.microsoft.com/en-us/library/0x4t63kb.aspx

     

    Thanks,

    Lhan Han

    • Marked as answer by Velnias Friday, December 30, 2011 4:10 PM
    Friday, December 30, 2011 6:55 AM
    Moderator