Recently, I have always wanted to build a MIS system. At least I should think it is good.
Encapsulate the data connection objects and data layers in the DLL to separate the interface from the business class and data operation class. To facilitate future system expansion.
{Role object data operation base class}
Tdbrole = Class (tinterfacedobject)
Protected
Froletabelname: string; // role table
Fdatasource: tdatasource;
Fdatasetprovider: tdatasetprovider;
Fclientdataset: tclientdataset;
Public
Constructor create;
Destructor destroy; override;
End;
{Tdbrole}
Constructor tdbrole. Create;
Begin
Inherited create;
Fdatasetprovider: = tdatasetprovider. Create (NiL );
Fdatasetprovider. Name: = 'fdatasetprovider ';
Fclientdataset: = tclientdataset. Create (NiL );
{The tdatasetprovider of the fclientdataset object is assigned a value. You cannot use the owner value of fclientdataset. providername to assign a value. If the value is compiled correctly, the datasetprovider object cannot be found during running}
Fclientdataset. setprovider (fdatasetprovider );
End;
Destructor tdbrole. Destroy;
Begin
Fdatasource: = nil;
{No data connection. The dataset cannot be found, so you do not need to close it again}
// Fclientdataset. close;
Fclientdataset. Free;
Fdatasetprovider. Free;
Inherited destroy;
End;