Msg 6522, Level 16, State 1, Procedure GetAll, Line 0
A .NET Framework error occurred during execution of user defined routine or aggregate 'GetAll':
System.Security.SecurityException: Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
System.Security.SecurityException:
at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.PermissionSet.Demand()
at System.Data.Common.DbConnectionOptions.DemandPermission()
at System.Data.SqlClient.SqlConnection.PermissionDemand()
at System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection outerConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at StoredProcedures.GetAll()
and the code for creating the stored procedure is:
SqlConnection connDB = new SqlConnection(@"Initial Catalog=MDB;Data Source=Server1;");
SqlCommand cmd = new SqlCommand();
cmd.Connection = connDB;
cmd.CommandText = "SELECT * FROM Modifier";
connDB.Open();
SqlDataReader rdr = cmd.ExecuteReader();
SqlContext.Pipe.Send(rdr);
rdr.Close();
connDB.Close();
your help is appreciated...

Can't Create a stored procedure in SQL Server 2005 from VS 2005 using C#
Christy Maxine
Hi Steve,
I got the same error (PublicKeyToken failed). Can you please give a detail instruction about how to change the Permission Level. I couldn't find "Database" under my project's "Properties". Thanks in advanced.
Daric
Wonder Andile