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...

Error in Creating Stored Procedure from VS 2005
CamCam
I am getting the same error when trying to debug my stored procedure. How do I get around int
Here's my code:
Try Dim conn As SqlConnection = New SqlConnectionconn.ConnectionString =
"Data Source=XXX-XXXX\SQLSERVER2005;Initial Catalog=MotorFleetConversion;User ID=xxxx;password=xxxx"conn.Open()
command =
New SqlCommand(sqlAction) 'command.Parameters.AddWithValue("@rating", rating)command.Connection = conn
' Execute the command and send the results directly to the client 'SqlContext.Pipe.ExecuteAndSend(command) Dim drUnitCode As SqlDataReader = command.ExecuteReader() While drUnitCode.Read If drUnitCode.Item("CompanyCode").ToString <> prevCompanyCode ThenagencySysNo = 0
If drUnitCode.Item("CompanyCode").ToString <> "" ThenagencySysNo = InsertAgency(drUnitCode.Item(
"CompanyCode").ToString, drUnitCode.Item("UC_DEPARTMENT_DESC").ToString, _Convert.ToBoolean(drUnitCode.Item(
"NCAS")), drUnitCode.Item("UC_BILLING_CODE").ToString) End If End If If agencySysNo > 0 ThenInsertDivision(agencySysNo, drUnitCode.Item(
"UC_DIVISION_DESC").ToString, drUnitCode.Item("UC_SHORT_DEPT_DIV").ToString, _drUnitCode.Item(
"UC_CODE_NUMBER").ToString) End IfprevCompanyCode = drUnitCode.Item(
"CompanyCode").ToString End While Catch ex As Exception End TryThanks!
prashant52197