Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. System.Security.SecurityException

System.Security.SecurityException

Scheduled Pinned Locked Moved C#
databasecsharphtmlvisual-studiosysadmin
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    OMalleyW
    wrote on last edited by
    #1

    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

    S 1 Reply Last reply
    0
    • O OMalleyW

      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

      S Offline
      S Offline
      shopi30
      wrote on last edited by
      #2

      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

      O 1 Reply Last reply
      0
      • S shopi30

        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

        O Offline
        O Offline
        OMalleyW
        wrote on last edited by
        #3

        thanks for the reply.. both are on the same machine. I will look around more on the MSDN2 site. Thanks again for the help. Will I hate users. Not all of them, just the ones who talk.CP member: Al Einstien

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups