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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Problem with GetSchemaTable

Problem with GetSchemaTable

Scheduled Pinned Locked Moved Database
questiondatabasehelp
3 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
    stofel
    wrote on last edited by
    #1

    Hi, I have a problem with a sql-Statement. I’m developing an application in which a user can type in a sql-statement, e.g. "Select * from (select name from employee)" . This statement is not very reasonable but it is syntactically correct. My code is OracleCommand cmd = new OracleCommand("Select * from (select name from employee)", myOracleConnection); OracleDataReader rdr = cmd.ExecuteReader(CommandBehavior.KeyInfo); System.Data.DataTable colinfo = rdr.GetSchemaTable(); At this staement the application crashed with an exception: "InvalidOperationException: Identifier expected or identifier in quotes expected" . (The message is in germaan: "Syntaxfehler: Erwartet wird ein Bezeichner bzw. Bezeichner in Anführungszeichen.", but i try to tranlate it in english) I want to use GetSchemaTable to get all the columninformation I needed to display the result. So how can I solve the problem ? Thanks in advances Willibert

    A 1 Reply Last reply
    0
    • S stofel

      Hi, I have a problem with a sql-Statement. I’m developing an application in which a user can type in a sql-statement, e.g. "Select * from (select name from employee)" . This statement is not very reasonable but it is syntactically correct. My code is OracleCommand cmd = new OracleCommand("Select * from (select name from employee)", myOracleConnection); OracleDataReader rdr = cmd.ExecuteReader(CommandBehavior.KeyInfo); System.Data.DataTable colinfo = rdr.GetSchemaTable(); At this staement the application crashed with an exception: "InvalidOperationException: Identifier expected or identifier in quotes expected" . (The message is in germaan: "Syntaxfehler: Erwartet wird ein Bezeichner bzw. Bezeichner in Anführungszeichen.", but i try to tranlate it in english) I want to use GetSchemaTable to get all the columninformation I needed to display the result. So how can I solve the problem ? Thanks in advances Willibert

      A Offline
      A Offline
      andyharman
      wrote on last edited by
      #2

      Does it work if you specify a table alias:   Select * from (select name from employee) **a** That should make the SQL legal.

      S 1 Reply Last reply
      0
      • A andyharman

        Does it work if you specify a table alias:   Select * from (select name from employee) **a** That should make the SQL legal.

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

        Hi, Select * from (select name from employee) is a legal statement, OracleClient and Toad could execute it. I could by-pass it, I change OracleDataReader rdr = cmd.ExecuteReader(CommandBehavior.KeyInfo); into OracleDataReader rdr = cmd.ExecuteReader(CommandBehavior.SchemaOnly); But their I don't get the basistablename even in a normal select. Tanks Willibert

        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