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. Multiple insert in single roundtrip with Sqlcommand, Possible???

Multiple insert in single roundtrip with Sqlcommand, Possible???

Scheduled Pinned Locked Moved Database
databasequestion
5 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.
  • A Offline
    A Offline
    abcxyz82
    wrote on last edited by
    #1

    My application has one web form where admin can add as many users as desired and at the end when he press SaveChanges I want to add all of them to database, There should be some way to pass arrays to stored procedure..I am looking for it or something similar to this.... Any Ideas!!! Thanks in advance... MaulikCE

    T _ 3 Replies Last reply
    0
    • A abcxyz82

      My application has one web form where admin can add as many users as desired and at the end when he press SaveChanges I want to add all of them to database, There should be some way to pass arrays to stored procedure..I am looking for it or something similar to this.... Any Ideas!!! Thanks in advance... MaulikCE

      T Offline
      T Offline
      ToddHileHoffer
      wrote on last edited by
      #2

      No, you can't pass an array. What you should do is open your connection and loop through array of users. Set the new parameter value and execute. Why would you need to pass an array? "People who never make mistakes, never do anything." My blog http://toddsnotsoamazinglife.blogspot.com/

      C 1 Reply Last reply
      0
      • T ToddHileHoffer

        No, you can't pass an array. What you should do is open your connection and loop through array of users. Set the new parameter value and execute. Why would you need to pass an array? "People who never make mistakes, never do anything." My blog http://toddsnotsoamazinglife.blogspot.com/

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

        ToddHileHoffer wrote: Why would you need to pass an array? I've had many occasions where I want to pass an array into a stored procedure so that it can perform all the actions in one pass rather than take serveral calls to the server.


        My: Blog | Photos | Next SQL Presentation WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More

        1 Reply Last reply
        0
        • A abcxyz82

          My application has one web form where admin can add as many users as desired and at the end when he press SaveChanges I want to add all of them to database, There should be some way to pass arrays to stored procedure..I am looking for it or something similar to this.... Any Ideas!!! Thanks in advance... MaulikCE

          _ Offline
          _ Offline
          _J_
          wrote on last edited by
          #4

          look here: http://www.sommarskog.se/arrays-in-sql.html[^] ------------------------------------ To study, study and only to study

          1 Reply Last reply
          0
          • A abcxyz82

            My application has one web form where admin can add as many users as desired and at the end when he press SaveChanges I want to add all of them to database, There should be some way to pass arrays to stored procedure..I am looking for it or something similar to this.... Any Ideas!!! Thanks in advance... MaulikCE

            _ Offline
            _ Offline
            _J_
            wrote on last edited by
            #5

            Another idea is : To call the Update method on a SQLDataAdapter, passiing it a modified dataset containing new, changed and or deleted rows. ------------------------------------ To study, study and only to study

            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