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. out prameter to store procedure in vb.net

out prameter to store procedure in vb.net

Scheduled Pinned Locked Moved Visual Basic
csharpdatabasemysql
6 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.
  • P Offline
    P Offline
    paya1pa
    wrote on last edited by
    #1

    hi expert i have created one table in mysql database the field name is ex. id,name,address so i want insert name and address in table by store procedure and get value of id by out parameter. name is in parameter address is in parameter id is out parameter

    I C 2 Replies Last reply
    0
    • P paya1pa

      hi expert i have created one table in mysql database the field name is ex. id,name,address so i want insert name and address in table by store procedure and get value of id by out parameter. name is in parameter address is in parameter id is out parameter

      I Offline
      I Offline
      i i i
      wrote on last edited by
      #2

      Con.Open()
      'Transaction = Con.BeginTransaction()
      Dim cmd As New SqlCommand("SP", Con)
      cmd.CommandType = CommandType.StoredProcedure
      cmd.ExecuteNonQuery()
      Variable = cmd.Parameters("@ID").Value
      'Transaction.Commit()
      Con.Close()

      Best Of Regards, SOFTDEV If you have knowledge, let others light their candles at it

      C 1 Reply Last reply
      0
      • I i i i

        Con.Open()
        'Transaction = Con.BeginTransaction()
        Dim cmd As New SqlCommand("SP", Con)
        cmd.CommandType = CommandType.StoredProcedure
        cmd.ExecuteNonQuery()
        Variable = cmd.Parameters("@ID").Value
        'Transaction.Commit()
        Con.Close()

        Best Of Regards, SOFTDEV If you have knowledge, let others light their candles at it

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #3

        That's great, if only it would work.

        Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

        I 1 Reply Last reply
        0
        • P paya1pa

          hi expert i have created one table in mysql database the field name is ex. id,name,address so i want insert name and address in table by store procedure and get value of id by out parameter. name is in parameter address is in parameter id is out parameter

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          When you add your parameters to the code for the proc, make sure you create the parameter explicitly, then add it to the list. That way, you can also set the Direction property ( from memory ) to specify it's an Out parameter. Then check the value on that variable after calling the procedure.

          Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

          I 1 Reply Last reply
          0
          • C Christian Graus

            That's great, if only it would work.

            Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

            I Offline
            I Offline
            i i i
            wrote on last edited by
            #5

            pauleeece correct me if ,their is any mistake

            Best Of Regards, SOFTDEV If you have knowledge, let others light their candles at it

            1 Reply Last reply
            0
            • C Christian Graus

              When you add your parameters to the code for the proc, make sure you create the parameter explicitly, then add it to the list. That way, you can also set the Direction property ( from memory ) to specify it's an Out parameter. Then check the value on that variable after calling the procedure.

              Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

              I Offline
              I Offline
              i i i
              wrote on last edited by
              #6

              Thanks, Yes you are right , like this cmd.Parameters.Add(New SqlParameter("@ID", SqlDbType.Int, 9, ParameterDirection.Output, False, 18, 0, "ID", DataRowVersion.Current, CInt(mCls.EM_ID)))

              Best Of Regards, SOFTDEV If you have knowledge, let others light their candles at it

              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