System.Security.SecurityException
-
Hello, Ok so I just figured out how to create an assembly with VS 2005 and SQL 2005 Express. So I wanted to see if I could create a little routing that connected to my sqlserver, hit a stored procedure and returned the results to the assemply. The results would be printed out when the assembly was executed. Here is the code for the CS file
using System; using System.Collections.Generic; using System.Text; using System.Data.SqlTypes; using System.Data.SqlClient; using Microsoft.SqlServer.Server; public class CountForMe { private System.Data.SqlClient.SqlConnection ProductionConnection; private System.Data.SqlClient.SqlCommand spListTypeCodes; [Microsoft.SqlServer.Server.SqlProcedure] public static void HereWeBe() { /*** * this is the entry point for the stored procedure * second attempt ta this to see what we can do **/ // in order to call a nonstatic class from within a static class // you must create the following reference to the class // reference: // ms-help://MS.VSExpressCC.v80/MS.NETFramework.v20.en/dv_cscomp/html/3ff67f11-bdf9-436b-bc0c-4fa3cd1925a6.htm CountForMe cfm = new CountForMe(); cfm.GetData(); cfm = null; // } private void GetData() { // initialize connection string ProductionConnection = new System.Data.SqlClient.SqlConnection(); spListTypeCodes = new System.Data.SqlClient.SqlCommand(); // ProductionConnection.ConnectionString = "{TAKEN OUT FOR SECURITY}"; // setup stored procedure spListTypeCodes.CommandText = "dbo.[spListTypeCodes]"; spListTypeCodes.CommandType = System.Data.CommandType.StoredProcedure; spListTypeCodes.Connection = ProductionConnection; spListTypeCodes.Parameters.Add(new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, false, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null)); // // ProductionConnection.Open(); SqlDataReader myReader = spListTypeCodes.ExecuteReader(); if (myReader.HasRows) { string message = ""; // setup message to print to screen message = "Type Code: " + myReader["TypeCode"].ToString() + " Type Description: " + myReader["TypeDescription"].ToString() + " Ty
-
Hello, Ok so I just figured out how to create an assembly with VS 2005 and SQL 2005 Express. So I wanted to see if I could create a little routing that connected to my sqlserver, hit a stored procedure and returned the results to the assemply. The results would be printed out when the assembly was executed. Here is the code for the CS file
using System; using System.Collections.Generic; using System.Text; using System.Data.SqlTypes; using System.Data.SqlClient; using Microsoft.SqlServer.Server; public class CountForMe { private System.Data.SqlClient.SqlConnection ProductionConnection; private System.Data.SqlClient.SqlCommand spListTypeCodes; [Microsoft.SqlServer.Server.SqlProcedure] public static void HereWeBe() { /*** * this is the entry point for the stored procedure * second attempt ta this to see what we can do **/ // in order to call a nonstatic class from within a static class // you must create the following reference to the class // reference: // ms-help://MS.VSExpressCC.v80/MS.NETFramework.v20.en/dv_cscomp/html/3ff67f11-bdf9-436b-bc0c-4fa3cd1925a6.htm CountForMe cfm = new CountForMe(); cfm.GetData(); cfm = null; // } private void GetData() { // initialize connection string ProductionConnection = new System.Data.SqlClient.SqlConnection(); spListTypeCodes = new System.Data.SqlClient.SqlCommand(); // ProductionConnection.ConnectionString = "{TAKEN OUT FOR SECURITY}"; // setup stored procedure spListTypeCodes.CommandText = "dbo.[spListTypeCodes]"; spListTypeCodes.CommandType = System.Data.CommandType.StoredProcedure; spListTypeCodes.Connection = ProductionConnection; spListTypeCodes.Parameters.Add(new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, false, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null)); // // ProductionConnection.Open(); SqlDataReader myReader = spListTypeCodes.ExecuteReader(); if (myReader.HasRows) { string message = ""; // setup message to print to screen message = "Type Code: " + myReader["TypeCode"].ToString() + " Type Description: " + myReader["TypeDescription"].ToString() + " Ty
Hello Will. Hello Everybody. Are you running de app from other PC? I think that sometime I had the same error when I tried to run an app from PC1 in PC2 via LAN. I did not found the solution but I'd read so much time later that It's necessary set permission in the Framework for do it this. I hope that someone can help us!. Atte. Anthony Acuña Phrase: Somebody tell me why it's more real when I dream that I'm wake
-
Hello Will. Hello Everybody. Are you running de app from other PC? I think that sometime I had the same error when I tried to run an app from PC1 in PC2 via LAN. I did not found the solution but I'd read so much time later that It's necessary set permission in the Framework for do it this. I hope that someone can help us!. Atte. Anthony Acuña Phrase: Somebody tell me why it's more real when I dream that I'm wake