Merhaba Arkadaşlar
query den sql ile aşağıda verdiğim şekilde checklistboxtan dbdride aktarmak istiyorum seçtiklerimi normal listboxa aktarıyor fakat query de sorguyu yenilediği için tek işaretlenen geliyor ben checklistboxtan seçtiğim hangi kayıtlar varsa ona göre gelmesini istiyorum
yardımlarınız için şimdiden teşekkürler.
var
i: integer;
begin
for I := 0 to CheckListBox1.Items.Count - 1 do
begin
if CheckListBox1.Checked[i] then
begin
// ShowMessage('Item at index ' + IntToStr(i) + ' is selected.' +
// 'Its value is '+ CheckListBox1.Items.Strings[i]);
personel_rapor.Close;
personel_rapor.UnPrepare;
personel_rapor.SQL.Clear;
personel_rapor.SQL.Add('select *from personel where sinifi='+#39+CheckListBox1.Items.Strings[i]+#39+' order by sinifi');
personel_rapor.Prepare;
personel_rapor.Open;
abc.Items.Add(CheckListBox1.Items.Strings[i]);
end;
end;
"Kula bela gelmez Hak yazmayınca,Hak bela yazmaz kul azmayınca..." MEVLANA
hocam bu olaya bir kaç tane daha checklistbox ekleyeceğim sql koduna diğer checkbox değerlerini getirmeye çalışıyorum or deyimi ile ayırmaya çalışıyorum ama olmadı yardımcı oabilirseniz sevinirim..
var
i,birim_i: integer;
Sart,birim_s:String;
begin
Sart:='';
for I := 0 to CheckListBox1.Items.Count - 1 do
begin
if CheckListBox1.Checked[i] then
begin
Sart:=Sart+','+QuotedStr(CheckListBox1.Items.Strings[i]);
end;
end;
if Sart<>'' then
Begin
delete(Sart,1,1);
Sart:=' and Sinifi in ('+Sart+')';
End;
//birimi başlangıç
birim_s:='';
for birim_i := 0 to CheckListBox2.Items.Count - 1 do
begin
if CheckListBox2.Checked[birim_i] then
begin
birim_s:=birim_s+','+QuotedStr(CheckListBox2.Items.Strings[birim_i]);
end;
end;
if birim_s<>'' then
Begin
delete(birim_s,1,1);
birim_s:=' and birimi in ('+birim_s+')';
End;
//birim son
personel_rapor.Close;
personel_rapor.UnPrepare;
personel_rapor.SQL.Clear;
personel_rapor.SQL.Add('select *from personel where 1=1 '+Sart or '1=1 '+birim_s);
personel_rapor.Prepare;
personel_rapor.Open;
"Kula bela gelmez Hak yazmayınca,Hak bela yazmaz kul azmayınca..." MEVLANA
var
i,birim_i: integer;
Sart,birim_s:String;
begin
Sart:='';
for I := 0 to CheckListBox1.Items.Count - 1 do
begin
if CheckListBox1.Checked[i] then
begin
Sart:=Sart+','+QuotedStr(CheckListBox1.Items.Strings[i]);
end;
end;
if Sart<>'' then
Begin
delete(Sart,1,1);
Sart:=' Sinifi in ('+Sart+')';
End;
//birimi başlangıç
birim_s:='';
for birim_i := 0 to CheckListBox2.Items.Count - 1 do
begin
if CheckListBox2.Checked[birim_i] then
begin
birim_s:=birim_s+','+QuotedStr(CheckListBox2.Items.Strings[birim_i]);
end;
end;
if birim_s<>'' then
Begin
delete(birim_s,1,1);
birim_s:=' birimi in ('+birim_s+')';
End;
//birim son
personel_rapor.Close;
personel_rapor.UnPrepare;
personel_rapor.SQL.Clear;
personel_rapor.SQL.Add('select *from personel where 1=1 ');
if (Sart <>'') and ('birim_s') Then
personel_rapor.SQL.Add(' or ('+Sart or '1=1 '+birim_s+')')
Else
if (Sart <>'')
personel_rapor.SQL.Add(' and '+Sart)
if '+birim_s<>'')
personel_rapor.SQL.Add(' and '+birim_s);
personel_rapor.Prepare;
personel_rapor.Open;