Skip to Content
0
Former Member
Jul 01, 2009 at 07:20 PM

add data to UDO

159 Views

hi all

i am trying to add some values into an udo, so b1 gives this

"MasterData Type UserTable can not add row"

this is the code

what's wrong?

UserTable oUst = (UserTable)B1Connections.diCompany.UserTables.Item("SPBZ_CONFIG_ONE");

            for (int i = 0; i < dtTable.Rows.Count; i++)
            {
                if (oUst.GetByKey(dtTable.Rows<i>["Code"].ToString()) == false)
                {
                    oUst.Code = dtTable.Rows<i>["Code"].ToString();
                    oUst.Name = dtTable.Rows<i>["Name"].ToString();
                    oUst.UserFields.Fields.Item("U_Ativ").Value = "Y";

                    oUst.Add();
                }
            }
            System.Runtime.InteropServices.Marshal.ReleaseComObject(oUst);