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. Visual Basic
  4. Passing a parameter to a stored procedure

Passing a parameter to a stored procedure

Scheduled Pinned Locked Moved Visual Basic
databasesql-serversysadminquestion
6 Posts 4 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.
  • N Offline
    N Offline
    Nine_
    wrote on last edited by
    #1

    I have created a stored procedure in MS SQL Server. It worked well there, but I want to call it from my vb application by sending a parameter to get the result from the database. Who can tell me how? Thankz

    M C 2 Replies Last reply
    0
    • N Nine_

      I have created a stored procedure in MS SQL Server. It worked well there, but I want to call it from my vb application by sending a parameter to get the result from the database. Who can tell me how? Thankz

      M Offline
      M Offline
      Manas Bhardwaj
      wrote on last edited by
      #2

      This shud help http://www.dotnetspider.com/kb/Article1867.aspx[^]

      1 Reply Last reply
      0
      • N Nine_

        I have created a stored procedure in MS SQL Server. It worked well there, but I want to call it from my vb application by sending a parameter to get the result from the database. Who can tell me how? Thankz

        C Offline
        C Offline
        Colin Angus Mackay
        wrote on last edited by
        #3

        Nine_ wrote:

        Who can tell me how?

        Did you mean: How do I do this? If I answer "Who can tell me how?" then my answer would have to be "I can" - but that is not very helpful to you. Is it? The SqlCommand object has a Parameters property. You just need to Add your parameters to it. e.g. cmd.Paramters.Add("@SomeParameter", someValue)


        Upcoming events: * Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ... * Reading: Developer Day 5 Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website

        S 1 Reply Last reply
        0
        • C Colin Angus Mackay

          Nine_ wrote:

          Who can tell me how?

          Did you mean: How do I do this? If I answer "Who can tell me how?" then my answer would have to be "I can" - but that is not very helpful to you. Is it? The SqlCommand object has a Parameters property. You just need to Add your parameters to it. e.g. cmd.Paramters.Add("@SomeParameter", someValue)


          Upcoming events: * Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ... * Reading: Developer Day 5 Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website

          S Offline
          S Offline
          szukuro
          wrote on last edited by
          #4

          I would just like to add, that for .NET 2.0 the Add method has been deprecated and the method AddWithValue should be used instead (with the same parameters).

          C 1 Reply Last reply
          0
          • S szukuro

            I would just like to add, that for .NET 2.0 the Add method has been deprecated and the method AddWithValue should be used instead (with the same parameters).

            C Offline
            C Offline
            Colin Angus Mackay
            wrote on last edited by
            #5

            szukuro wrote:

            I would just like to add, that for .NET 2.0 the Add method has been deprecated

            That is not entirely true. Only one overload of the Add method has been deprecated. The remaining overloads are acceptable.


            Upcoming events: * Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ... * Reading: Developer Day 5 Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website

            N 1 Reply Last reply
            0
            • C Colin Angus Mackay

              szukuro wrote:

              I would just like to add, that for .NET 2.0 the Add method has been deprecated

              That is not entirely true. Only one overload of the Add method has been deprecated. The remaining overloads are acceptable.


              Upcoming events: * Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ... * Reading: Developer Day 5 Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website

              N Offline
              N Offline
              Nine_
              wrote on last edited by
              #6

              Thanks alot

              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