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. ADO Command->Execute throws exception

ADO Command->Execute throws exception

Scheduled Pinned Locked Moved Database
c++databasehelp
4 Posts 2 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.
  • S Offline
    S Offline
    ssirisha
    wrote on last edited by
    #1

    Using Access 2000 and ADO VC++6.0 I am executing the following statement.. VARIANT Params[2]; Params[0].vt = VT_I2; Params[0].iVal = 1; Params[1].vt = VT_R4; Params[1].fltVal = 8.99; m_pCommand->adCmdText = "Query4"; m_pCommand->ActiveConnection = m_pConnection; m_pCommand->Execute(0, Params, adCmdStoredProc); Generates an exception {DB_E_PARAMNOTOPTIONAL} Query4 in Access is as follows: PARAMETERS vID Short, Rad IEEESingle; INSERT INTO TABLE1 ( ODID, MeasRadius ) VALUES (vID, Rad); Thanks for your help in advance.

    C 1 Reply Last reply
    0
    • S ssirisha

      Using Access 2000 and ADO VC++6.0 I am executing the following statement.. VARIANT Params[2]; Params[0].vt = VT_I2; Params[0].iVal = 1; Params[1].vt = VT_R4; Params[1].fltVal = 8.99; m_pCommand->adCmdText = "Query4"; m_pCommand->ActiveConnection = m_pConnection; m_pCommand->Execute(0, Params, adCmdStoredProc); Generates an exception {DB_E_PARAMNOTOPTIONAL} Query4 in Access is as follows: PARAMETERS vID Short, Rad IEEESingle; INSERT INTO TABLE1 ( ODID, MeasRadius ) VALUES (vID, Rad); Thanks for your help in advance.

      C Offline
      C Offline
      Carlos Antollini
      wrote on last edited by
      #2

      You need to inform the type of Param, if input or output, for example... But I see that you are passing a float param,, in that case you MUST to inform the presicion and the scale Regards Carlos Antollini. Sonork ID 100.10529 cantollini

      S 1 Reply Last reply
      0
      • C Carlos Antollini

        You need to inform the type of Param, if input or output, for example... But I see that you are passing a float param,, in that case you MUST to inform the presicion and the scale Regards Carlos Antollini. Sonork ID 100.10529 cantollini

        S Offline
        S Offline
        ssirisha
        wrote on last edited by
        #3

        How to inform in/out or precision and scale in argument list of Execute method. Thanks

        C 1 Reply Last reply
        0
        • S ssirisha

          How to inform in/out or precision and scale in argument list of Execute method. Thanks

          C Offline
          C Offline
          Carlos Antollini
          wrote on last edited by
          #4

          I saw that you are using a variant to inform the parameters, but if you use use a Parameter type you must to do the following...

          pParameter->Direction = (ParameterDirectionEnum)nDirection;
          pParameter->PutPrecision(nPrecision);
          pParameter->PutNumericScale(nScale);

          Remember: When you are using a parameter type float, double, decimal, you must to inform the presisicion and the scale... Regards Carlos Antollini. Sonork ID 100.10529 cantollini

          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