locked
Deleting a row from the database (Oracle.DataAccess) RRS feed

  • Question

  • User-338080069 posted

    Hi all,

    I am getting an error "No overload for method 'add' takes '2' arguments" for the lines delete.add. Can someone please tell me what is the right way to use the delete.add ? Thanks in advance

    PROJ_TABLE proj_Table = new PROJ_TABLE();
        Delete delete = new Delete("PROJ_TABLE");
        
        delete.add("CODE", proj_Table.CODE);
        delete.add("NAME",proj_Table.NAME);                                    
        delete.add(Expression.eq("CODE", proj_Table_AG.CODE));
        int ret = DB.execute(delete);
        return ret;
    Wednesday, March 21, 2012 10:58 PM

Answers

  • User-2076991548 posted

    I might be a real jerk trying to help you on this matter but I've never seen before such sintaxis.

    Are you using a framewok? like hibernate?

    what do you see when you navigate to delete.add's definition ? (F12 over the "add" word)

    where is detele() object defined?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, March 22, 2012 1:15 AM
  • User-1360095595 posted
    You are calling .add() with 2 parameters yes I don't see any add method that accepts 2 parameters in the Delete class.
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, March 22, 2012 11:00 AM

All replies

  • User-2076991548 posted

    I might be a real jerk trying to help you on this matter but I've never seen before such sintaxis.

    Are you using a framewok? like hibernate?

    what do you see when you navigate to delete.add's definition ? (F12 over the "add" word)

    where is detele() object defined?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, March 22, 2012 1:15 AM
  • User-338080069 posted

    Sorry! It came from a user defined class. I have been going through the codes and still cannot see why it would need 2 arguments based on my first post.. strange.

     public class Delete
        {
            String from;
            AndList where = new AndList();
            public Delete(String table)
            {
                from = table;
            }
    
            public Delete add(Expression e)
            {
                if (e != null)
                    where.add(e);
                return this;
            }
            public Delete add(OrList e)
            {
                if (e != null && e.count > 0)
                    where.add(e);
                return this;
            }
            public Delete add(AndList e)
            {
                if (e != null && e.count > 0)
                    where.add(e);
                return this;
            }
            public override string ToString()
            {
                StringBuilder str = new StringBuilder();
                str.Append("DELETE FROM ").Append(from);
                if (where.count > 0)
                {
                    str.Append(" WHERE ");
                    str.Append(where);
                }
                return str.ToString();
            }
        }
    Thursday, March 22, 2012 3:54 AM
  • User-2076991548 posted

    is your issue solved? how can i help you further?

    Thursday, March 22, 2012 10:41 AM
  • User-1360095595 posted
    You are calling .add() with 2 parameters yes I don't see any add method that accepts 2 parameters in the Delete class.
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, March 22, 2012 11:00 AM