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. is the order of parameters addition to a command for update command realy required?

is the order of parameters addition to a command for update command realy required?

Scheduled Pinned Locked Moved C#
databasehelptutorialquestionannouncement
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
    nicolus
    wrote on last edited by
    #1

    i am using an oledbcommand object to perform both insert and update based on the command text supplied and i am adding the parameters for update also in the order of insert. So incase of update though, its not giving any error/exception but database is not getting updated. Can any body pls tell me how to resolve this or any other way to implement both the functionalities using single method. Thanks in advance.

    C 1 Reply Last reply
    0
    • N nicolus

      i am using an oledbcommand object to perform both insert and update based on the command text supplied and i am adding the parameters for update also in the order of insert. So incase of update though, its not giving any error/exception but database is not getting updated. Can any body pls tell me how to resolve this or any other way to implement both the functionalities using single method. Thanks in advance.

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

      You need to specify either the parameters by name ( in any order ), or pass them in the order that a stored proc you're calling requires them ( although I suspect you're using the nasty 'dynamic SQL in the presentation layer' stuff here )

      Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      N D 2 Replies Last reply
      0
      • C Christian Graus

        You need to specify either the parameters by name ( in any order ), or pass them in the order that a stored proc you're calling requires them ( although I suspect you're using the nasty 'dynamic SQL in the presentation layer' stuff here )

        Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

        N Offline
        N Offline
        nicolus
        wrote on last edited by
        #3

        thanks now its working (yes order mattered).

        1 Reply Last reply
        0
        • C Christian Graus

          You need to specify either the parameters by name ( in any order ), or pass them in the order that a stored proc you're calling requires them ( although I suspect you're using the nasty 'dynamic SQL in the presentation layer' stuff here )

          Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          OleDb doesn't support named parameters. You have to specifiy them in the exact order they appear in the SQL statement. Well, you can give them names all you want, they won't do anything... Yet another reason why I never use Access anymore.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007

          P 1 Reply Last reply
          0
          • D Dave Kreskowiak

            OleDb doesn't support named parameters. You have to specifiy them in the exact order they appear in the SQL statement. Well, you can give them names all you want, they won't do anything... Yet another reason why I never use Access anymore.

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007

            P Offline
            P Offline
            PIEBALDconsult
            wrote on last edited by
            #5

            I've found that naming them allows the use of a parameter value multiple times in the statement. And is it an OleDb thing or a Jet Engine thing?

            D 1 Reply Last reply
            0
            • P PIEBALDconsult

              I've found that naming them allows the use of a parameter value multiple times in the statement. And is it an OleDb thing or a Jet Engine thing?

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              I never bothered to figure that one out. I'm guessing that since you can't do it in VA code in Access either that the "problem" would be tied to Jet, but I could be wrong.

              A guide to posting questions on CodeProject[^]
              Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                   2006, 2007

              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