Home > Back-end >  The database problem in Delphi
The database problem in Delphi

Time:09-26

Private
{Private declarations}
Public
{Public declarations}
OrderSQL: string;
SVirtualSQL, ListSQL, MasterSQL GroupSQL, MainSQL: String;
Procedure SetMasterSQL (SQL: String);
SQL: procedure SetSQL (String);
Procedure SetDetailSQL (SQL: String);
Procedure SetState (Value: Boolean);
Procedure SetQryOrderSQL (SQL: String);
end;

Var
PP_SamplePlanFrm: TPP_SamplePlanFrm;
DepartMent: string;
Implementation
USES UntWaxConst;
{$R *. DFM}
The function CreateBplForm (ParamList: TStrings) : TForm;
The begin
DepartMent:=ParamList. Values [' DepartMent '];
PP_SamplePlanFrm:=TPP_SamplePlanFrm. Create (Application);
Result:=PP_SamplePlanFrm;
end;

Procedure TPP_SamplePlanFrm. BtnExitClick (Sender: TObject);
The begin
Inherited;
The Close;
end;

Procedure TPP_SamplePlanFrm. FormShow (Sender: TObject);
Var StrA: string;
The begin
Inherited;

OrderSQL:='Select Distinct Keith SaleOrderNo from SD_ProdNote_D H' +
'Left Join dbo. SD_ProdNote_M I On I.G uid=H.S D_ProdNote_MGuid' +
'Left Join dbo. SD_Order_D J On J.G uid=i. D_Order_DGuid' +
'Left Join dbo. SD_Order_M K On K.G uid=J.S D_Order_MGuid' +
'Where 1=1 +
'Order by Keith SaleOrderNo Desc';
If the Trim (DepartMent) & lt;> "' then
The begin
StrA:='Select sEmployeeID sEmployeeName, sDeptID from BD_Person A' +
'Where sUpdateStatus<>='+' 'delete' and sDeptID QuotedStr (DepartMent);
QryUser. SQL. Text:=strA;
LpkUser. SQL. Text:=strA;
LpkUser. SearchSQL. Text:=StrA;
end;
QryUser. Open;
ListSQL:='Select A. *, D.s CustCode, D.s CustName' +
'the From PP_LabDye_M A' +
'Left Join SD_Customer D On D.G uid=A.S D_CustomerGUID';
MasterSQL:='Select D.s CustCode, D.s CustName, B.s CustFab, B.d Date, B.G UID' +
'the From PP_LabDye_D A' +
'Left Join PP_LabDye_M B On B.G uid=a. d. SampMGUID' +
'Left Join SD_Customer D On D.G uid=B.S D_CustomerGUID';

GroupSQL:='Group By D.s CustCode, D.s CustName, B.s CustFab, B.d Date, B.G UID';

MainSQL:='Select A. *, C.d Date, C.f QuanControll As MfQuanControll, E.s EmployeeName, E1. SEmployeeName As EmployeeName, G.s SysDataName' +
'As sCup, F.s SysDataName As sSeason, c.s. CustFab, c.s. SampleNO, D.s CustName' +
'the From PP_LabDye_D A' +
Be sad uid=chtistina georgina rossetti.british poetess 'Left join PP_LabDye_M C On a. d. SampMGUID' +
'Left join SD_Customer D On D.g c.s. D_CustomerGUID uid=' +
'Left join BD_Person E On E.s EmployeeID=A.s UserID' +
'Left join BD_Person E1 On E1. SEmployeeID=A.s InputManID' +
'Left Join SysDataList G On G.s SysDataGroupId=', '3008', 'And G.s SysDataId=A.s CupID' +
'Left Join SysDataList F On F.s SysDataGroupId=', '1009', 'And F.s SysDataId=A.s SeasonID' +
'Order by a. d. InputDate Desc';
SVirtualSQL:='union' +
'the Select D.s CustCode, D.s CustName, B.s CustFab, B.d Date, B.G UID' +
'the From PP_LabDye_D A' +
'Left Join PP_LabDye_M B On B.G uid=a. d. SampMGUID' +
'Left Join SD_Customer D On D.G uid=B.S D_CustomerGUID' +
'where sVirtual=' '; 'y'

QryDifficulty. Connection:=the Self. The Connection;
QryDifficulty. Open;

end;

Procedure TPP_SamplePlanFrm. LpkCustomerLookUpPost (Sender: TObject);
The begin
Inherited;
SetMasterSQL (MakeSQL (MasterSQL, 'D.s CustCode=' + QuotedStr (lpkCustomer. Values [' sCustCode '])) + GroupSQL);
If qryMaster. IsEmpty then
The begin
SetSQL (MakeSQL (ListSQL, '1=2'));
SetDetailSQL (MakeSQL (MainSQL, '1=2'));
end;
end;

He defines several SQL in front and in the late part of the statement in red, what is the meaning of this? And if rewritten in c #, this code should be how to rewrite,,, please everyone a great god gives directions, I am a new guy

CodePudding user response:

Nothing in particular, the beginning MasterSQL first to attach the value, and then click, call a method, seemingly filter, filtering based on certain conditions, is the result of the query in MasterSQL statements out of the filter

CodePudding user response:

reference 1st floor BDMH response:
nothing in particular, MasterSQL first to attach the value at the beginning, and then click, call a method, seemingly filter, filtering based on certain conditions, is the result of the query in MasterSQL statements out filter

That is to say, he concluded that runs beneath the SQL is all the condition after the operation of SQL?
  • Related