delphi4arab منتديات دلفي للعرب
منشئ الاكواد - نسخة قابلة للطباعة

+- delphi4arab منتديات دلفي للعرب (https://delphi4arab.net/forum)
+-- قسم : منتديات دلفي الأخرى (https://delphi4arab.net/forum/forumdisplay.php?fid=4)
+--- قسم : برامج دلفي من عمل الأعضاء (https://delphi4arab.net/forum/forumdisplay.php?fid=27)
+--- الموضوع : منشئ الاكواد (/showthread.php?tid=9373)

الصفحات: 1 2


RE: منشئ الاكواد - Delphi4Us - 08-05-2018

تقريبا انتهيت من البرنامج ولكن اريد اي فكرة لاضيفها في البرنامج ليضيفها في الكود

سيعجبكم البرنامج ان شاء الله وهذه المرة هو مبرمج بالدلفي بالكامل

[صورة: 3c5595de0b6be79.jpg]


[صورة: d470d5e08333785.jpg]





كود :
// Author: delphi4arab // Homepage: http://www.delphi4arab.net // Date: 2018-05-08 // Insert New Record By Execute SqL Query // First Definition of a numeric variable For maxId Query Var Int :Integer; // Create a query to fetch the largest number With QryMaxID Do begin  .Close;  .Sql.clear;  .Sql.Add('Select Max(id) as MaxId from Emplyee;  .Open;   Int := .FieldByName('MaxId').Asintegre + 1;  .Close; End; // The command prompt to create a query add the required record Try With QryEmplyee Do begin  .Close;  .SQL.Clear;  .SQL.Add('Insert Into Emplyee(ID,FirstNmame,LastName,Age,City,Phone,Address) Values (:ID,:FirstNmame,:LastName,:Age,:City,:Phone,:Address)'); // Add Parameters to Query Control  .ParamByName('ID').Value:= Int;  .ParamByName('FirstNmame').Value:= Trim(TxtFirstNmame.Text);  .ParamByName('LastName').Value:= Trim(TxtLastName.Text);  .ParamByName('Age').Value:= Trim(TxtAge.Text);  .ParamByName('City').Value:= Trim(TxtCity.Text);  .ParamByName('Phone').Value:= Trim(TxtPhone.Text);  .ParamByName('Address').Value:= Trim(TxtAddress.Text);  .ExecSQL;  ShowMessage('Ok File is Added'); except on E: Exception do  ShowMessage('Error'); end; end; // Other Way // Insert New Record Directly By Table // Definition of a numeric variable For maxId Query Var Int :Integer; // Create a query to fetch the largest number With QryMaxID Do begin  .Close;  .Sql.clear;  .Sql.Add('Select Max(id) as MaxId from Emplyee;  .Open;   Int := .FieldByName('MaxId').Asintegre + 1;  .Close; End; // The command prompt to create a query add the required record Try With TblEmplyee Do begin  .Append;  .FieldByName('ID').Value:= Int;  .FieldByName('FirstNmame').Value:= Trim(TxtFirstNmame.Text);  .FieldByName('LastName').Value:= Trim(TxtLastName.Text);  .FieldByName('Age').Value:= Trim(TxtAge.Text);  .FieldByName('City').Value:= Trim(TxtCity.Text);  .FieldByName('Phone').Value:= Trim(TxtPhone.Text);  .FieldByName('Address').Value:= Trim(TxtAddress.Text);  .Post;  ShowMessage('Ok File is Added'); except on E: Exception do  ShowMessage('Error'); end; end; // The command prompt to create a Update query the required record Try With QryEmplyee Do begin  .Close;  .SQL.Clear;  .SQL.Add('Update Emplyee Set(ID=:ID,FirstNmame=:FirstNmame,LastName=:LastName,Age=:Age,City=:City,Phone=:Phone,Address=:Address))'; // Add Parameters to Query Control  .ParamByName('ID').Value:= Int;  .ParamByName('FirstNmame').Value:= Trim(TxtFirstNmame.Text);  .ParamByName('LastName').Value:= Trim(TxtLastName.Text);  .ParamByName('Age').Value:= Trim(TxtAge.Text);  .ParamByName('City').Value:= Trim(TxtCity.Text);  .ParamByName('Phone').Value:= Trim(TxtPhone.Text);  .ParamByName('Address').Value:= Trim(TxtAddress.Text);  .ExecSQL;  ShowMessage('Ok File is Updated'); except on E: Exception do  ShowMessage('Error'); end; end; // Other Way // Update New Record Directly By Table // Definition of a numeric variable For maxId Query Var Int :Integer; // Create a query to fetch the largest number With QryMaxID Do begin  .Close;  .Sql.clear;  .Sql.Add('Select Max(id) as MaxId from Emplyee;  .Open;   Int := .FieldByName('MaxId').Asintegre + 1;  .Close; End; // The command prompt to create a query add the required record Try With TblEmplyee Do begin  .Edit;  .FieldByName('ID').Value:= Int;  .FieldByName('FirstNmame').Value:= Trim(TxtFirstNmame.Text);  .FieldByName('LastName').Value:= Trim(TxtLastName.Text);  .FieldByName('Age').Value:= Trim(TxtAge.Text);  .FieldByName('City').Value:= Trim(TxtCity.Text);  .FieldByName('Phone').Value:= Trim(TxtPhone.Text);  .FieldByName('Address').Value:= Trim(TxtAddress.Text);  .Post;  ShowMessage('Ok File is Updated'); except on E: Exception do  ShowMessage('Error'); end; end; // Query for Delete Try With QryEmplyee Do begin  .Close;  .Sql.clear;  .Sql.Add('Delete * From Emplyee where ID=:ID');  .ExecSQL;  .Close; End;  ShowMessage('Ok File is Deleted'); except on E: Exception do  ShowMessage('Error'); end; end; // Directly bt Table TblEmplyee.Delete; // Sql Insert Statement Insert Into Emplyee(ID,FirstNmame,LastName,Age,City,Phone,Address) Values (:ID,:FirstNmame,:LastName,:Age,:City,:Phone,:Address)'); // Sql Update Statement Update Emplyee Set(ID=:ID,FirstNmame=:FirstNmame,LastName=:LastName,Age=:Age,City=:City,Phone=:Phone,Address=:Address))'; // Sql Delete Statement Delete * From Emplyee where ID=:ID

الكود الاخير هو ما يكتبه ، اشعر انه قليل ربما يمكن هناك ما نضيفه أليه