gpayne
(Greg Payne)
September 25, 2023, 11:04pm
5
This should be fairly clean in an ubaq or a function. Here are a couple of threads. the first one is on clearing out a ud and the second is one of many where @timshuwy shows how to use UpdateExt.
suggest making it a little better to make sure that everything is in a scope… here is another version that should work:
using (var x = Ice.IceDataContext.CreateDefaultTransactionScope()){
foreach (var ud15 in Db.UD15) {
Db.DeleteObject(ud15);
}
Db.Validate();
x.Complete();
}
I like to use the UpdateExt Method because it does most of the work for you… if the record already exists, it will update the fields you provide. If the record doesnt exist yet, it will add it. You can set RowMod to “D” and it will delete the record.
here is a sample of code. Change the UD Field names to whatever you desire.
using(var svc = Ice.Assemblies.ServiceRenderer.GetService<Ice.Contracts.UD12SvcContract>()) {
//Build and add the UD12 record
var UD12 = new Ice.Tablesets.UD12Row…
1 Like