Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2008
    Posts
    3

    Post Unanswered: ORA-00936:missing expression

    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:-

    Code:
    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

  2. #2
    Join Date
    Jul 2008
    Posts
    3

    Post ORA-00936:missing expression

    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:-

    Code:
    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

    edit by loquin: Why are you posting a c#/Oracle question in the Visual Basic forum? I would have suggested that it be posted in the dotNet forum, or in the Oracle forum... so I'll move it there.
    Last edited by loquin; 07-15-08 at 17:01.

  3. #3
    Join Date
    Jul 2008
    Posts
    5
    this error occurs when there is some mismatch in your tables constraints fields
    and u are inserting value.

    means some constraints voilated using the insert stmt.
    it may be (in table ) some field contains not null or check constraints.

  4. #4
    Join Date
    Jul 2008
    Posts
    3

    Post ORA-00936:missing expression

    thanks for the reply pankaj. in the oracle table i had set the constraints of all fields as "not null" and i was trying to insert data into only one field...this means that the values in the other fields had to be null. now, i changed the constraints of all the fields as "null" but it is still giving the same error i.e . missing expression.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •