Selam. Database ve listview de ki ürün numaraları tutuyorsa ve bu ürün 'SU KAYAĞI' ise her birini toplamda kaç tane olduğunu nasıl bulabilirim?
Örnek:
2 ŞAMREL
3 SU KAYAĞI
3 SU KAYAĞI
3 SU KAYAĞI ----> TOPLAM 3 ADET
4 MİSİNA
4 MİSİNA
5 SU KAYAĞI
5 SU KAYAĞI
5 SU KAYAĞI
5 SU KAYAĞI
5 SU KAYAĞI
5 SU KAYAĞI----> TOPLAM 6 ADET
Örnek:
2 ŞAMREL
3 SU KAYAĞI
3 SU KAYAĞI
3 SU KAYAĞI ----> TOPLAM 3 ADET
4 MİSİNA
4 MİSİNA
5 SU KAYAĞI
5 SU KAYAĞI
5 SU KAYAĞI
5 SU KAYAĞI
5 SU KAYAĞI
5 SU KAYAĞI----> TOPLAM 6 ADET
procedure TForm6.AdetleriGir(Sender: TObject); var R, HBSay: Integer; begin HBSay := 0; With QPLNew, STList do begin for R := 0 to Items.Count - 1 do begin Connection := PLConnection; Close; SQL.Clear; SQL.Add('Select * From FIRMALAR'); SQL.Add('Where URUNNO=:KN'); ParamByName('KN').AsString := Items[R].SubItems[1]; Prepared := True; Open; Items.BeginUpdate; try if (Pos(FieldByName('URUNNO').AsString, Items[R].SubItems[1]) > 0) and (Pos(FieldByName('URUN').AsString, 'SU KAYAĞI') > 0) then begin inc(HBSay); Items[R].SubItems[2] := IntToStr(HBSay) + ' Adet var'; end; finally Items.EndUpdate; end; end; end; end;
Hayat bazen güzel olabiliyor.