الحذف من قاعدة البيانات عن طريق CheckListBox1
#1
إقتباس :
PHP كود :
لدى CheckListBox1 وربطه ب edit1 , edit2 ,edit3 ووضعت تلك الاكواد

procedure TForm2
.FormActivate(Sender: TObject);
begin
        
//if ADOTable1q is not empty then
 
 if (ADOTable1z.Text <> '')  then
   begin
CheckListBox1
.Items.Add(adoTable1.FieldByName('z').AsString);
 
  end;
 
       //if ADOTable1z is not empty then
 
 if (ADOTable1zz.Text <> '')  then
   begin

 CheckListBox1
.Items.Add(adoTable1.FieldByName('zz').AsString);
 
          //if ADOTable1z is not empty then
 
  end;
 
 if (ADOTable1q.Text <> '')  then
   begin

 CheckListBox1
.Items.Add(adoTable1.FieldByName('q').AsString);
 
 end;
 
  ADOTable1.Close;
 
    ADOTable1.Open;
end;


procedure TForm2.Button4Click(Sender: TObject);
 
    begin
   
try
 
 ADOTable1.Edit;
 
OpenDialog1.Options:=[ofHideReadOnly,ofAllowMultiSelect,ofEnableSizing];
if 
OpenDialog1.Execute() then
begin
    CheckListBox1
.Items.add(OpenDialog1.FileName);
 
CheckListBox1.ItemIndex := CheckListBox1.Items.Count -1 ;
//Do Something ...

 
 end;

except
     
exit;

 
   end;



end;



procedure TForm2.CheckListBox1Click(Sender: TObject);
begin
  try
       
//if ADOTable1q is not empty then
 
 if (ADOTable1q.Text <> '') and (ADOTable1z.Text <> '') and (ADOTable1zz.Text <> '')then
begin

 end
 
else
 
   begin
     
if (ADOTable1q.Text <> '') and (ADOTable1z.Text <> '') then
      begin
    dbEdit24
.Text := CheckListBox1.Items[CheckListBox1.ItemIndex];
 
    end
 
else
 
   begin

       
//if ADOTable1q is not empty then
 
 if (ADOTable1q.Text <> '')  then
   begin
     dbEdit23
.Text := CheckListBox1.Items[CheckListBox1.ItemIndex];

 
 end
   
else
 
   begin

    dbEdit22
.Text := CheckListBox1.Items[CheckListBox1.ItemIndex];

 
  end;
 
   begin

   end
;
 
 end;
 
  end;
except
     
exit;

 
   end;
end;



procedure TForm2.CheckListBox1DblClick(Sender: TObject);
begin
 
if (DataSource1.State =dsinsert)or (DataSource1.State =dsEdit) then
 begin
 ADOTable1
.Post;
 
end
 
else
 
begin




 ShellExecute
(Handle,'open',PChar(CheckListBox1.Items.Strings[CheckListBox1.ItemIndex]),nil,nil, SW_SHOWNORMAL);

end;
 
end; 
كيف لى عند حذف سطر معين به رابط  من [size=large]CheckListBox1[/size] يتم حذف ذات الرابط من قاعدة البيانات  

وشكراً لكم
الرد
#2
(16-10-2015, 09:47 PM)محمد .م.م كتب :
إقتباس :
PHP كود :
لدى CheckListBox1 وربطه ب edit1 , edit2 ,edit3 ووضعت تلك الاكواد

procedure TForm2
.FormActivate(Sender: TObject);
begin
        
//if ADOTable1q is not empty then
 
 if (ADOTable1z.Text <> '')  then
   begin
CheckListBox1
.Items.Add(adoTable1.FieldByName('z').AsString);
 
  end;
 
       //if ADOTable1z is not empty then
 
 if (ADOTable1zz.Text <> '')  then
   begin

 CheckListBox1
.Items.Add(adoTable1.FieldByName('zz').AsString);
 
          //if ADOTable1z is not empty then
 
  end;
 
 if (ADOTable1q.Text <> '')  then
   begin

 CheckListBox1
.Items.Add(adoTable1.FieldByName('q').AsString);
 
 end;
 
  ADOTable1.Close;
 
    ADOTable1.Open;
end;


procedure TForm2.Button4Click(Sender: TObject);
 
    begin
   
try
 
 ADOTable1.Edit;
 
OpenDialog1.Options:=[ofHideReadOnly,ofAllowMultiSelect,ofEnableSizing];
if 
OpenDialog1.Execute() then
begin
    CheckListBox1
.Items.add(OpenDialog1.FileName);
 
CheckListBox1.ItemIndex := CheckListBox1.Items.Count -1 ;
//Do Something ...

 
 end;

except
     
exit;

 
   end;



end;



procedure TForm2.CheckListBox1Click(Sender: TObject);
begin
  try
       
//if ADOTable1q is not empty then
 
 if (ADOTable1q.Text <> '') and (ADOTable1z.Text <> '') and (ADOTable1zz.Text <> '')then
begin

 end
 
else
 
   begin
     
if (ADOTable1q.Text <> '') and (ADOTable1z.Text <> '') then
      begin
    dbEdit24
.Text := CheckListBox1.Items[CheckListBox1.ItemIndex];
 
    end
 
else
 
   begin

       
//if ADOTable1q is not empty then
 
 if (ADOTable1q.Text <> '')  then
   begin
     dbEdit23
.Text := CheckListBox1.Items[CheckListBox1.ItemIndex];

 
 end
   
else
 
   begin

    dbEdit22
.Text := CheckListBox1.Items[CheckListBox1.ItemIndex];

 
  end;
 
   begin

   end
;
 
 end;
 
  end;
except
     
exit;

 
   end;
end;



procedure TForm2.CheckListBox1DblClick(Sender: TObject);
begin
 
if (DataSource1.State =dsinsert)or (DataSource1.State =dsEdit) then
 begin
 ADOTable1
.Post;
 
end
 
else
 
begin




 ShellExecute
(Handle,'open',PChar(CheckListBox1.Items.Strings[CheckListBox1.ItemIndex]),nil,nil, SW_SHOWNORMAL);

end;
 
end; 
كيف لى عند حذف سطر معين به رابط  من [size=large]CheckListBox1[/size] يتم حذف ذات الرابط من قاعدة البيانات  

وشكراً لكم

(16-10-2015, 09:47 PM)محمد .م.م كتب :
إقتباس :
PHP كود :
لدى CheckListBox1 وربطه ب edit1 , edit2 ,edit3 ووضعت تلك الاكواد

procedure TForm2
.FormActivate(Sender: TObject);
begin
        
//if ADOTable1q is not empty then
 
 if (ADOTable1z.Text <> '')  then
   begin
CheckListBox1
.Items.Add(adoTable1.FieldByName('z').AsString);
 
  end;
 
       //if ADOTable1z is not empty then
 
 if (ADOTable1zz.Text <> '')  then
   begin

 CheckListBox1
.Items.Add(adoTable1.FieldByName('zz').AsString);
 
          //if ADOTable1z is not empty then
 
  end;
 
 if (ADOTable1q.Text <> '')  then
   begin

 CheckListBox1
.Items.Add(adoTable1.FieldByName('q').AsString);
 
 end;
 
  ADOTable1.Close;
 
    ADOTable1.Open;
end;


procedure TForm2.Button4Click(Sender: TObject);
 
    begin
   
try
 
 ADOTable1.Edit;
 
OpenDialog1.Options:=[ofHideReadOnly,ofAllowMultiSelect,ofEnableSizing];
if 
OpenDialog1.Execute() then
begin
    CheckListBox1
.Items.add(OpenDialog1.FileName);
 
CheckListBox1.ItemIndex := CheckListBox1.Items.Count -1 ;
//Do Something ...

 
 end;

except
     
exit;

 
   end;



end;



procedure TForm2.CheckListBox1Click(Sender: TObject);
begin
  try
       
//if ADOTable1q is not empty then
 
 if (ADOTable1q.Text <> '') and (ADOTable1z.Text <> '') and (ADOTable1zz.Text <> '')then
begin

 end
 
else
 
   begin
     
if (ADOTable1q.Text <> '') and (ADOTable1z.Text <> '') then
      begin
    dbEdit24
.Text := CheckListBox1.Items[CheckListBox1.ItemIndex];
 
    end
 
else
 
   begin

       
//if ADOTable1q is not empty then
 
 if (ADOTable1q.Text <> '')  then
   begin
     dbEdit23
.Text := CheckListBox1.Items[CheckListBox1.ItemIndex];

 
 end
   
else
 
   begin

    dbEdit22
.Text := CheckListBox1.Items[CheckListBox1.ItemIndex];

 
  end;
 
   begin

   end
;
 
 end;
 
  end;
except
     
exit;

 
   end;
end;



procedure TForm2.CheckListBox1DblClick(Sender: TObject);
begin
 
if (DataSource1.State =dsinsert)or (DataSource1.State =dsEdit) then
 begin
 ADOTable1
.Post;
 
end
 
else
 
begin




 ShellExecute
(Handle,'open',PChar(CheckListBox1.Items.Strings[CheckListBox1.ItemIndex]),nil,nil, SW_SHOWNORMAL);

end;
 
end; 
كيف لى عند حذف سطر معين به رابط  من [size=large]CheckListBox1[/size] يتم حذف ذات الرابط من قاعدة البيانات  

وشكراً لكم

لقد وجدت الحل
كود :
procedure TForm2.Button3Click(Sender: TObject); begin   ADOTable1.Edit;    if CheckListBox1.Items[CheckListBox1.ItemIndex]  = ADOTable1['q'] then    begin     ADOTable1q.Clear ;    end    else      begin      if CheckListBox1.Items[CheckListBox1.ItemIndex]  = ADOTable1['qq'] then    begin     ADOTable1qq.Clear ; end;  end;
الرد


التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم