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. Run Stored Procedure on MS SQL 2005

Run Stored Procedure on MS SQL 2005

Scheduled Pinned Locked Moved C#
helpdatabasecsharpsql-serversysadmin
4 Posts 3 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.
  • M Offline
    M Offline
    MinarikM
    wrote on last edited by
    #1

    Hi, could anybody help me? I am trying to run stored procedure on MS SQL 2005. The procedure have one parameter and delete all old records for machine equal to the parameter. I have tried execute it directly in MS SQL Server Management Studio Express and everything was OK. I assign execute rights for the user I used from C# to connect the SQL server but every time I have tried to run the procedure from C# using SQLCommand object I have received the error message in a Output window: A first chance exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll Where could be the problem?

    A N 2 Replies Last reply
    0
    • M MinarikM

      Hi, could anybody help me? I am trying to run stored procedure on MS SQL 2005. The procedure have one parameter and delete all old records for machine equal to the parameter. I have tried execute it directly in MS SQL Server Management Studio Express and everything was OK. I assign execute rights for the user I used from C# to connect the SQL server but every time I have tried to run the procedure from C# using SQLCommand object I have received the error message in a Output window: A first chance exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll Where could be the problem?

      A Offline
      A Offline
      andre_swnpl
      wrote on last edited by
      #2

      You should put a try-catch block over the code and catch the SqlException specifically - then you can check the inner-exception. that will tell you what is going wrong.

      1 Reply Last reply
      0
      • M MinarikM

        Hi, could anybody help me? I am trying to run stored procedure on MS SQL 2005. The procedure have one parameter and delete all old records for machine equal to the parameter. I have tried execute it directly in MS SQL Server Management Studio Express and everything was OK. I assign execute rights for the user I used from C# to connect the SQL server but every time I have tried to run the procedure from C# using SQLCommand object I have received the error message in a Output window: A first chance exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll Where could be the problem?

        N Offline
        N Offline
        Nouman Bhatti
        wrote on last edited by
        #3

        Use try/catch block and in catch block see the error message of your exception so that u'll know more about the error.

        M 1 Reply Last reply
        0
        • N Nouman Bhatti

          Use try/catch block and in catch block see the error message of your exception so that u'll know more about the error.

          M Offline
          M Offline
          MinarikM
          wrote on last edited by
          #4

          I already did it before but it jump to Catch but there was no Message... I have finally found the problem now, my error. Sorry for pointless question and Thanks for your reactions...

          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