The Records is not in editable state

SOLVED

Hi,

I got this "The Records is not in editable state" Error while delete contact from Ar_CustomerContact_bus object. 

Please anyone give hint to solve this issue.

Thanks.

Parents
  • 0
    verified answer
    Hint: summit's wrong in your code.
  • 0 in reply to 49153
    Hi,

    Here is the code.



    object pvx = null;
    object oSS = null;
    CreateLogFiles Err = new CreateLogFiles();
    // Instantiate a ProvidexX.Script object and initialize with the path to MAS90\Home
    pvx = System.Activator.CreateInstance(Type.GetTypeFromProgID("ProvideX.Script", true));
    // Replace the text "*PATH TO MAS90\HOME*" with the correct MAS90\Home path in the line below
    pvx.GetType().InvokeMember("Init", BindingFlags.InvokeMethod, null, pvx, new object[] { ConfigurationManager.AppSettings["SagePath"].ToString() });



    // Instantiate a new Session object and initialize the session
    // by setting the user, company, date and module
    oSS = pvx.GetType().InvokeMember("NewObject", BindingFlags.InvokeMethod, null, pvx, new object[] { "SY_Session" });




    oSS.GetType().InvokeMember("nSetCompany", BindingFlags.InvokeMethod, null, oSS, new object[] { ConfigurationManager.AppSettings["CompanyName"].ToString() });

    oSS.GetType().InvokeMember("nSetDate", BindingFlags.InvokeMethod, null, oSS, new object[] { "A/R", "07252016" });

    oSS.GetType().InvokeMember("nSetModule", BindingFlags.InvokeMethod, null, oSS, new object[] { "A/R" });

    oSS.GetType().InvokeMember("nSetUser", BindingFlags.InvokeMethod, null, oSS, new object[] { "user", "password" });

    oSS.GetType().InvokeMember("nLogon", System.Reflection.BindingFlags.InvokeMethod, null, oSS, null);



    int TaskID = (int)oSS.GetType().InvokeMember("nLookupTask", System.Reflection.BindingFlags.InvokeMethod, null, oSS, new object[] { "AR_CustomerContact_ui" });

    oSS.GetType().InvokeMember("nSetProgram", System.Reflection.BindingFlags.InvokeMethod, null, oSS, null);


    m_object = pvx.GetType().InvokeMember("NewObject", BindingFlags.InvokeMethod, null, pvx, new object[] { "AR_CustomerContact_bus", oSS });



    object retVal = 0;

    retVal = oARCustomerEntry.InvokeMethodByRef("nSetKeyValue", new object[] { "ARDivisionNo$", ConfigurationManager.AppSettings["ARDivisionNo"] });
    retVal = oARCustomerEntry.InvokeMethodByRef("nSetKeyValue", new object[] { "CustomerNo$", ConfigurationManager.AppSettings["CustomerNo"] });
    retVal = oARCustomerEntry.InvokeMethodByRef("nSetKeyValue", new object[] { "ContactCode$", ConfigurationManager.AppSettings["ContactCode"] });



    retVal = oARCustomerEntry.InvokeMethod("nDelete");
    Err.ErrorLog(".//", "Execute Delete");

    if (retVal.ToString() == "0")
    {
    object errorMsg = oARCustomerEntry.GetProperty("sLastErrorMsg");
    Console.WriteLine(errorMsg.ToString());
    Err.ErrorLog(".//", errorMsg.ToString());
    Console.Read();
    }

    // string customerNumber = nextCustomerNumber[0].ToString();

    Console.WriteLine(retVal.ToString());

    Console.Read();
    }
    catch (Exception ex)
    {
    object errorMsg = oARCustomerEntry.GetProperty("sLastErrorMsg");
    Err.ErrorLog(".//", errorMsg.ToString());
    Console.WriteLine(errorMsg.ToString());
    Console.WriteLine(ex.Message);
    Console.Read();
    }






    thanks
  • 0 in reply to sf_developer
    If you are using SetKeyValue to set each individual field that comprises the key to the table, you must then execute the SetKey method to put the record into an editable state.
  • 0 in reply to Steve Passmore
    Thanks Steve,

    It's resolve my error, But still it's not delete the records, can you please tell me from where I can get that what parameter need to pass for the delete a record? I mean key parameter ?

    Here is the code

    string par = ConfigurationManager.AppSettings["ARDivisionNo"] + "-" + ConfigurationManager.AppSettings["CustomerNo"] + ConfigurationManager.AppSettings["ContactCode"];

    retVal = oARCustomerEntry.InvokeMethod("nDelete", par);

    It's return the 1, But it is not delete the record.

    Please help me, give me some hint or some reference document where I can check the key parameter.

    Thanks,
Reply
  • 0 in reply to Steve Passmore
    Thanks Steve,

    It's resolve my error, But still it's not delete the records, can you please tell me from where I can get that what parameter need to pass for the delete a record? I mean key parameter ?

    Here is the code

    string par = ConfigurationManager.AppSettings["ARDivisionNo"] + "-" + ConfigurationManager.AppSettings["CustomerNo"] + ConfigurationManager.AppSettings["ContactCode"];

    retVal = oARCustomerEntry.InvokeMethod("nDelete", par);

    It's return the 1, But it is not delete the record.

    Please help me, give me some hint or some reference document where I can check the key parameter.

    Thanks,
Children