my_report.DataDefinition.SortFields[0].Field = def;
And receive this exception:
Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))
Source Error:
Line 89: DatabaseFieldDefinition def = my_report.Database.Tables["PLANO"].Fields["DESIG"];
Line 90: int c = my_report.DataDefinition.SortFields.Count;
Line 91: my_report.DataDefinition.SortFields[0].Field = def;

SortFields