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. Database & SysAdmin
  3. Database
  4. Stored proc call - passing a parameter [modified]

Stored proc call - passing a parameter [modified]

Scheduled Pinned Locked Moved Database
beta-testinghelptutorialquestiondiscussion
2 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.
  • I Offline
    I Offline
    IMC2006
    wrote on last edited by
    #1

    I have an app with a DAL and so far I have been calling sprocs that require no input parameters and all works fine. I now have to call a sproc with requires an input paramter. The sproc I am calling is as follows: ALTER PROCEDURE dbo.prc_QA_SysCodes_sel_drop_fill ( @sysCodeType as int ) As BEGIN DECLARE @Err Int SELECT A.[SysCodeID], A.[SysCodeDesc] FROM [Contract].[dbo].[QA_SysCodes] A WHERE A.SysCodeType = @sysCodeType order by A.[SortOrder], A.[SysCodeID] Set @Err = @@Error RETURN @Err End I need to pass in the @sysCodeType but can't figure out how to pass it to the sproc. Thoughts, words of wisdom? -- modified at 13:16 Tuesday 27th June, 2006

    E 1 Reply Last reply
    0
    • I IMC2006

      I have an app with a DAL and so far I have been calling sprocs that require no input parameters and all works fine. I now have to call a sproc with requires an input paramter. The sproc I am calling is as follows: ALTER PROCEDURE dbo.prc_QA_SysCodes_sel_drop_fill ( @sysCodeType as int ) As BEGIN DECLARE @Err Int SELECT A.[SysCodeID], A.[SysCodeDesc] FROM [Contract].[dbo].[QA_SysCodes] A WHERE A.SysCodeType = @sysCodeType order by A.[SortOrder], A.[SysCodeID] Set @Err = @@Error RETURN @Err End I need to pass in the @sysCodeType but can't figure out how to pass it to the sproc. Thoughts, words of wisdom? -- modified at 13:16 Tuesday 27th June, 2006

      E Offline
      E Offline
      Elina Blank
      wrote on last edited by
      #2

      Add parameter to your procedure: yourSP.Parameters.Add(ParamName, SqlParamType, length); //length is optional Pass value to the param yourSP.Parameters[ParamName].Value = ParamValue; Sincerely, Elina Life is great!!! Enjoy every moment of it! :-O

      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