2

I've been attempting for the last couple of days to update unidata using sample code as a basis using .NET without success. I can read the database successfully and view the raw data within visual studio. The error reported back is a out of range error. The program is attempting to update the unit price of a purchase order.

Error: {" Error on Socket Receive. Index was outside the bounds of the array.POD"} [IBMU2.UODOTNET.UniFileException]: {" Error on Socket Receive. Index was outside the bounds of the array.POD"} Data: {System.Collections.ListDictionaryInternal} HelpLink: null HResult: -2146232832 InnerException: null Message: " Error on Socket Receive. Index was outside the bounds of the array.POD" Source: "UniFile Class" StackTrace: " at IBMU2.UODOTNET.UniFile.Write()\r\n at IBMU2.UODOTNET.UniFile.Write(String aRecordID, UniDynArray aRecordData)\r\n at ReadXlsToUnix.Form1.TestUpdate(String PO_LINE_SHIP, String price) in c:\Users\xxx\Documents\Visual Studio 2013\Projects\ReadXlsToUnix\ReadXlsToUnix\Form1.cs:line 330" TargetSite: {Void Write()}

failing Test Code is:

private void TestUpdate(string PO_LINE_SHIP,string price)
 { 
        UniFile      pod =null;
        UniSession uniSession   =null;
        //connection string
        uniSession = UniObjects.OpenSession("unixMachine", "userid", Properties.Settings.Default.PWD, "TRAIN", "udcs");
        //open file
        pod = uniSession.CreateUniFile("POD");
        //read data 
        pod.Read(PO_LINE_SHIP);
        //locking strategy
        pod.UniFileLockStrategy = 1;
        pod.UniFileReleaseStrategy = 1;
        if (pod.RecordID == ""){ 
           pod.UnlockRecord();
        }
        //replace existing value with one entered by user
        pod.Record.Replace(4, (string)uniSession.Iconv(price, "MD4"));
        try
        {
              pod.Write(pod.RecordID,pod.Record);   //RecordId and Record both show correctly hover/immediate window
              //pod.Write() fails with same message 

        }
        catch (Exception err)
        {
            MessageBox.Show("Error" + err);
        }
            pod.Close();
            UniObjects.CloseSession(uniSession);
        }
}

Running on HP UX 11.31 unidata 7.2 and using UODOTNET.dll 2.2.3.7377 Any help greatly appreciated. This is the write record version and have also tried writefield functionality with same error.

Rajan - thanks for the update and link. I have tried unsuccessfully to read/update my unidata tables using the U2 Toolkit. I can however read/update a file I have created within the same account. Does this mean there is a missing entry somewhere VOC, DICT for example.

rfc
  • 21
  • 2
  • We recommend to use U2 Toolkit for .NET for such type of application. We have UO.NET functionality embedded in U2 Toolkit for .NET. We have sample code in this directory (C:\Program Files (x86)\Rocket Software\..\samples\C#\UniData). Please download U2 Toolkit for .NET v2.1.0 and try this sample code. You can send email to u2askus@rocketsoftware.com for download link. To know more about U2 Toolkit for .NET, please read : http://www.rocketsoftware.com/products/rocket-u2-toolkit-net https://github.com/RocketSoftware/multivalue-lab/tree/master/U2/Demos/U2-Toolkit – Rajan Kumar Mar 17 '15 at 16:48
  • Thank you for installing U2 Toolkit for .NET. For your issue, I need Log File. Could you please create Log File and send to this email u2askus@rocketsoftware.com? For details, how to create log file, see this link https://github.com/RocketSoftware/multivalue-lab/tree/master/U2/Demos/U2-Toolkit/Log%20File Rajan – Rajan Kumar Mar 24 '15 at 19:24
  • Thank you. I got the Log File and I am reviewing it. – Rajan Kumar Mar 28 '15 at 17:31

0 Answers0