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 / C++ / MFC
  4. Access ODBC exception

Access ODBC exception

Scheduled Pinned Locked Moved C / C++ / MFC
question
9 Posts 5 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.
  • E Offline
    E Offline
    eusto
    wrote on last edited by
    #1

    i've used the wizzard to add class derived from CRecordset for an access table (let's say CRSmytable). i get "Too few parameters. Expected 3" exception thrown by CRSmytable.Open(). Any ideea why? Or, at least..what does this exception mean?

    R _ E D 4 Replies Last reply
    0
    • E eusto

      i've used the wizzard to add class derived from CRecordset for an access table (let's say CRSmytable). i get "Too few parameters. Expected 3" exception thrown by CRSmytable.Open(). Any ideea why? Or, at least..what does this exception mean?

      R Offline
      R Offline
      Rajesh R Subramanian
      wrote on last edited by
      #2

      The exception means what it says. You are passing fewer parameters to the function CRecordSet::Open() than what it expects. BTW Can you post the code?

      Nobody can give you wiser advice than yourself. - Cicero

      E 1 Reply Last reply
      0
      • E eusto

        i've used the wizzard to add class derived from CRecordset for an access table (let's say CRSmytable). i get "Too few parameters. Expected 3" exception thrown by CRSmytable.Open(). Any ideea why? Or, at least..what does this exception mean?

        _ Offline
        _ Offline
        _AnsHUMAN_
        wrote on last edited by
        #3

        eusto wrote:

        Too few parameters. Expected 3

        You are passing less parameter's to the function where you are calling it.See if you are missing out on passing some parameter values to the function.

        Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

        E 1 Reply Last reply
        0
        • R Rajesh R Subramanian

          The exception means what it says. You are passing fewer parameters to the function CRecordSet::Open() than what it expects. BTW Can you post the code?

          Nobody can give you wiser advice than yourself. - Cicero

          E Offline
          E Offline
          eusto
          wrote on last edited by
          #4

          i'm not passing any arguments.. The constructor of the recordset recieves a pointer to the opend connection to the database. From what i know, it should do a "select * from table"... the code:

              CRSLoads line(&pApp->db);
                  line.Open();
          
          H 1 Reply Last reply
          0
          • _ _AnsHUMAN_

            eusto wrote:

            Too few parameters. Expected 3

            You are passing less parameter's to the function where you are calling it.See if you are missing out on passing some parameter values to the function.

            Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

            E Offline
            E Offline
            eusto
            wrote on last edited by
            #5

            CRecordset::Open() with no params should work..it works with firebird and mysql. It actually works with other tables in the access db that i use except this one :( I don't get it

            1 Reply Last reply
            0
            • E eusto

              i've used the wizzard to add class derived from CRecordset for an access table (let's say CRSmytable). i get "Too few parameters. Expected 3" exception thrown by CRSmytable.Open(). Any ideea why? Or, at least..what does this exception mean?

              E Offline
              E Offline
              eusto
              wrote on last edited by
              #6

              I'll reply to my own post so maybe someone would benefit from it The error was caused by the class wizzard wich inserted some columns that did not belong to that table. 3 of them

              1 Reply Last reply
              0
              • E eusto

                i've used the wizzard to add class derived from CRecordset for an access table (let's say CRSmytable). i get "Too few parameters. Expected 3" exception thrown by CRSmytable.Open(). Any ideea why? Or, at least..what does this exception mean?

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #7

                It means there is a discrepency between the number of columns being retrieved with the SELECT statement and the number of variables in the record set. Everything must match! I would also suggest setting a breakpoint within CRecordset::Open() and single-stepping through that method so you'll know exactly what is going on. Until you can narrow an exception or an assertion down to the actual line, you're just guessing.


                "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                "Judge not by the eye but by the heart." - Native American Proverb

                E 1 Reply Last reply
                0
                • E eusto

                  i'm not passing any arguments.. The constructor of the recordset recieves a pointer to the opend connection to the database. From what i know, it should do a "select * from table"... the code:

                      CRSLoads line(&pApp->db);
                          line.Open();
                  
                  H Offline
                  H Offline
                  Hamid Taebi
                  wrote on last edited by
                  #8

                  And if you set parameters for it what happens?


                  WhiteSky


                  1 Reply Last reply
                  0
                  • D David Crow

                    It means there is a discrepency between the number of columns being retrieved with the SELECT statement and the number of variables in the record set. Everything must match! I would also suggest setting a breakpoint within CRecordset::Open() and single-stepping through that method so you'll know exactly what is going on. Until you can narrow an exception or an assertion down to the actual line, you're just guessing.


                    "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                    "Judge not by the eye but by the heart." - Native American Proverb

                    E Offline
                    E Offline
                    eusto
                    wrote on last edited by
                    #9

                    Thanks i've solved it. It was exactly what you've said. I'm not used to access, i usually had a sql server behind my applications. The problem was between keyboard and my chair. I've generated the recordset from one db file and was running the program on another one.

                    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