0

Error Again

I am trying to perform update action in Visual Studio 2010 ultimate with Windows form as the front end and Oracle 11g express as the back end. I am using c# to code this.

 private void update_student(string STUDENT_ID, string STUDENT_NAME, string STUDENT_ADDRESS)
    {
        con.Open();

        String sql = "UPDATE STUDENT SET STUDENT_NAME = :STUDENT_NAME, STUDENT_ADDRESS= :STUDENT_ADDRESS WHERE STUDENT_ID= :STUDENT_ID";

        OracleCommand query = new OracleCommand(sql, con);

        OracleParameter[] updatestud = new OracleParameter[3];

        //updatestud[0] = query.Parameters.Add("STUDENT_ID", OracleDbType.Varchar2, STUDENT_ID, ParameterDirection.Input);
        updatestud[0] = query.Parameters.Add("STUDENT_ID", OracleDbType.Int32, STUDENT_ID, ParameterDirection.Input);
        updatestud[1] = query.Parameters.Add("STUDENT_NAME", OracleDbType.Varchar2, STUDENT_NAME, ParameterDirection.Input);
        updatestud[2] = query.Parameters.Add("STUDENT_ADDRESS", OracleDbType.Varchar2, STUDENT_ADDRESS, ParameterDirection.Input);

        query.ExecuteNonQuery();

        MessageBox.Show("Row Updated");

        con.Close();

    }

After performing insertion and retrieval actions I am now trying out Update query.

I couldn't understand the flow of parameters and values of the following code that I have used in my application. I get the following error in the query.ExecuteNonQuery(); line:

ORA-01722: invalid number I got suggestions to check the Oracle Type. But in spite of the correction, I find the same error. Even After correcting the Oracle type, I find the same error. Any suggestions?

4

0 回答 0