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. Managed C++/CLI
  4. OracleDataReader undeclared identifier error

OracleDataReader undeclared identifier error

Scheduled Pinned Locked Moved Managed C++/CLI
databaseoracledata-structuresdebugginghelp
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.
  • R Offline
    R Offline
    Reveille
    wrote on last edited by
    #1

    I have a function that queries an Oracle DB. For some reason I receive two errors on each statement in my __finally block. Is there something wrong with my declarations? Errors: error C2065: 'myReader' : undeclared identifier error C2227: left of '->Close' must point to class/struct/union/generic type error C2065: 'myOracleConnection' : undeclared identifier error C2227: left of '->Close' must point to class/struct/union/generic type My code that generates the errors: cPacket ^queryPacket(String ^cmd, String ^con) { //test if the passed arguments are empty if(con->Equals("")) { MessageBox::Show("Oracle Connection String Empty o.O","Error in Form1::queryPacket"); } if(cmd->Equals("")) { MessageBox::Show("Oracle Command String Empty o.O","Error in Form1::queryPacket"); } try { OracleConnection ^myOracleConnection = gcnew OracleConnection(con); OracleCommand ^myOracleCommand = gcnew OracleCommand(cmd, myOracleConnection); myOracleConnection->Open(); OracleDataReader ^myReader = myOracleCommand->ExecuteReader(CommandBehavior::CloseConnection); myReader->Close();//I put this in here to debug. The statement doesnt throw any errors and inteliSense picks up the myReader object so I'm assuming that it works fine. }//end try catch (Exception ^ex) { MessageBox::Show(ex->Message,"Exception in class PaCCaP's function queryPacket", MessageBoxButtons::OK, MessageBoxIcon::Exclamation); }//end catch __finally { myReader->Close(); //this is where the first 2 errors are generated myOracleConnection->Close(); //and the second 2 }//end finally I'm hoping this is something small that I've overlooked, possibly in my declarations? Also, It It's not too much to ask, How do you create a 1-dimensional array of objects in the 2005 syntax (I just switched over from 2003 and trackable ^ pointers are a bit fuzzy to me. All suggestions are appreciated. Thanks!

    L 2 Replies Last reply
    0
    • R Reveille

      I have a function that queries an Oracle DB. For some reason I receive two errors on each statement in my __finally block. Is there something wrong with my declarations? Errors: error C2065: 'myReader' : undeclared identifier error C2227: left of '->Close' must point to class/struct/union/generic type error C2065: 'myOracleConnection' : undeclared identifier error C2227: left of '->Close' must point to class/struct/union/generic type My code that generates the errors: cPacket ^queryPacket(String ^cmd, String ^con) { //test if the passed arguments are empty if(con->Equals("")) { MessageBox::Show("Oracle Connection String Empty o.O","Error in Form1::queryPacket"); } if(cmd->Equals("")) { MessageBox::Show("Oracle Command String Empty o.O","Error in Form1::queryPacket"); } try { OracleConnection ^myOracleConnection = gcnew OracleConnection(con); OracleCommand ^myOracleCommand = gcnew OracleCommand(cmd, myOracleConnection); myOracleConnection->Open(); OracleDataReader ^myReader = myOracleCommand->ExecuteReader(CommandBehavior::CloseConnection); myReader->Close();//I put this in here to debug. The statement doesnt throw any errors and inteliSense picks up the myReader object so I'm assuming that it works fine. }//end try catch (Exception ^ex) { MessageBox::Show(ex->Message,"Exception in class PaCCaP's function queryPacket", MessageBoxButtons::OK, MessageBoxIcon::Exclamation); }//end catch __finally { myReader->Close(); //this is where the first 2 errors are generated myOracleConnection->Close(); //and the second 2 }//end finally I'm hoping this is something small that I've overlooked, possibly in my declarations? Also, It It's not too much to ask, How do you create a 1-dimensional array of objects in the 2005 syntax (I just switched over from 2003 and trackable ^ pointers are a bit fuzzy to me. All suggestions are appreciated. Thanks!

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      myReader and myOracleConnection go out of scope at the end of the try block. Declare them outside the try block.

      System.IO.Path.IsPathRooted() does not behave as I would expect

      1 Reply Last reply
      0
      • R Reveille

        I have a function that queries an Oracle DB. For some reason I receive two errors on each statement in my __finally block. Is there something wrong with my declarations? Errors: error C2065: 'myReader' : undeclared identifier error C2227: left of '->Close' must point to class/struct/union/generic type error C2065: 'myOracleConnection' : undeclared identifier error C2227: left of '->Close' must point to class/struct/union/generic type My code that generates the errors: cPacket ^queryPacket(String ^cmd, String ^con) { //test if the passed arguments are empty if(con->Equals("")) { MessageBox::Show("Oracle Connection String Empty o.O","Error in Form1::queryPacket"); } if(cmd->Equals("")) { MessageBox::Show("Oracle Command String Empty o.O","Error in Form1::queryPacket"); } try { OracleConnection ^myOracleConnection = gcnew OracleConnection(con); OracleCommand ^myOracleCommand = gcnew OracleCommand(cmd, myOracleConnection); myOracleConnection->Open(); OracleDataReader ^myReader = myOracleCommand->ExecuteReader(CommandBehavior::CloseConnection); myReader->Close();//I put this in here to debug. The statement doesnt throw any errors and inteliSense picks up the myReader object so I'm assuming that it works fine. }//end try catch (Exception ^ex) { MessageBox::Show(ex->Message,"Exception in class PaCCaP's function queryPacket", MessageBoxButtons::OK, MessageBoxIcon::Exclamation); }//end catch __finally { myReader->Close(); //this is where the first 2 errors are generated myOracleConnection->Close(); //and the second 2 }//end finally I'm hoping this is something small that I've overlooked, possibly in my declarations? Also, It It's not too much to ask, How do you create a 1-dimensional array of objects in the 2005 syntax (I just switched over from 2003 and trackable ^ pointers are a bit fuzzy to me. All suggestions are appreciated. Thanks!

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        cpp_and_asm wrote:

        How do you create a 1-dimensional array of objects in the 2005 syntax

        I think this is it

        array^ myarray = gcnew array(size goes here);

        System.IO.Path.IsPathRooted() does not behave as I would expect

        R 1 Reply Last reply
        0
        • L Lost User

          cpp_and_asm wrote:

          How do you create a 1-dimensional array of objects in the 2005 syntax

          I think this is it

          array^ myarray = gcnew array(size goes here);

          System.IO.Path.IsPathRooted() does not behave as I would expect

          R Offline
          R Offline
          Reveille
          wrote on last edited by
          #4

          Thanks Alot Josh!! :)

          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