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. ORA-00936:missing expression

ORA-00936:missing expression

Scheduled Pinned Locked Moved Database
csharphelpdatabaseoraclevisual-studio
2 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.
  • V Offline
    V Offline
    varun_mca_ju 0
    wrote on last edited by
    #1

    I have a textbox called "textBox6.text" in a C# Windows Application in Visual Studio, and i want that the text entered by the user in the textbox should be added to the "PURPOSE" field in a table "TABLE2_HDB1" in Oracle database "HDB1" on clicking a "submit" button. the coding for submit button is as follows:- private void button1_Click(object sender, EventArgs e) { string OracleStmt; string ConString; OleDbConnection cn = null; OleDbCommand cmd = null; try { OracleStmt = "insert into TABLE2_HDB1(PURPOSE) values(@PURPOSE)"; ConString = " Provider=MSDAORA;Data Source=HDb1;User Id=SYSTEM ;Password=*****;"; cn = new OleDbConnection(ConString); cmd = new OleDbCommand(OracleStmt, cn); cmd.Parameters.Add(new OleDbParameter("@PURPOSE", OleDbType.VarChar , 20)); cmd.Parameters["@PURPOSE"].Value = textBox6.Text; cn.Open(); cmd.ExecuteNonQuery(); textBox8 .Text = "record inserted successfully"; } catch (Exception ex) { textBox8 .Text = ex.Message; } finally { cn.Close(); } } on executing this code u get the error :- ORA-00936:missing expression plz. help :~

    W 1 Reply Last reply
    0
    • V varun_mca_ju 0

      I have a textbox called "textBox6.text" in a C# Windows Application in Visual Studio, and i want that the text entered by the user in the textbox should be added to the "PURPOSE" field in a table "TABLE2_HDB1" in Oracle database "HDB1" on clicking a "submit" button. the coding for submit button is as follows:- private void button1_Click(object sender, EventArgs e) { string OracleStmt; string ConString; OleDbConnection cn = null; OleDbCommand cmd = null; try { OracleStmt = "insert into TABLE2_HDB1(PURPOSE) values(@PURPOSE)"; ConString = " Provider=MSDAORA;Data Source=HDb1;User Id=SYSTEM ;Password=*****;"; cn = new OleDbConnection(ConString); cmd = new OleDbCommand(OracleStmt, cn); cmd.Parameters.Add(new OleDbParameter("@PURPOSE", OleDbType.VarChar , 20)); cmd.Parameters["@PURPOSE"].Value = textBox6.Text; cn.Open(); cmd.ExecuteNonQuery(); textBox8 .Text = "record inserted successfully"; } catch (Exception ex) { textBox8 .Text = ex.Message; } finally { cn.Close(); } } on executing this code u get the error :- ORA-00936:missing expression plz. help :~

      W Offline
      W Offline
      Wendelius
      wrote on last edited by
      #2

      Try to use : instead of @. So in your example it would be like:

      OracleStmt = "insert into TABLE2_HDB1 (PURPOSE) values(:PURPOSE)";
      ...
      cmd.Parameters.Add(new OleDbParameter(":PURPOSE", OleDbType.VarChar , 20));
      cmd.Parameters[":PURPOSE"].Value = textBox6.Text;

      I'm not sure that if this correct when using OleDBConnection, but it works with native OracleConnection Mika

      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