I'm experiencing something that I can't figure out. In a Pascal script, I try to delete a record using MyDataset.Dataset.Delete. I'm first opening it with Mydataset.dataset.open, still I get the error "Cannot perform this operation on a closed dataset when evaluating instruction CallProc" on the line where I put the MyDataset.Dataset.Delete instruction. The dataset is consisting of one record that I try to delete. To check if the dataset has a record I did put a showmessagebox with the value of a record field. The messagebox does show data when the script is executed. Here is my code:
lWorkLeaveBO:=TBusinessObject.Create('WorkLeave');
lWorkLeaveBO.UserSQL:='ObjectID=' + lItemId;
lWorkLeaveBO.Dataset.Open;
showmessage(lWorkLeaveBO.FieldByName('FromDate').AsString);
lWorkLeaveBO.Dataset.Delete;
lWorkLeaveBO.Free; ```