on 10-27-2016 10:22 PM - last edited on 02-03-2024 5:23 PM by postmig_api_4
I have a UDT (not UDO). I want to use the .Remove method, because I want to clean up after myself, and the table is no longer needed. The UDT is empty, meaning it has no records/rows/keys. How do I use that method, without first using .GetByKey? Or must one first always .Add and then .GetByKey on the code that was just added? Is there another method?
Hi David,
You first should call GetByKey method.
A sample:
UserTablesMD oUserTableMD = null;
try
{
oUserTableMD = (SAPbobsCOM.UserTablesMD)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserTables);
if (oUserTableMD.GetByKey("Your user table name without @"))
{
if(oUserTableMD.Remove() != 0)
{
//Something wrong, look oCompany.GetLastErrorCode() and oCompany.GetLastErrorDescription()
}
}
else
{
//The table was not found
}
}
catch(Exception ex)
{
//Something wrong
}
finally
{
//Release the resources used
if (oUserTableMD != null)
{
Marshal.ReleaseComObject(oUserTableMD);
oUserTableMD = null;
}
}
Kind Regards,
Diego Lother
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
99 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.