26-04-2022, Saat: 10:44
(26-04-2022, Saat: 09:56)OZCANK Adlı Kullanıcıdan Alıntı:(25-04-2022, Saat: 15:25)cinarbil Adlı Kullanıcıdan Alıntı: Dbgrid' de böyle bir özellik var mı bilmiyorum ama ben olsam nasıl yapardım ?
dbgrid onDrawCell özelliğine
eğer grid ilk satırı değilse ve eklenen satır belge no bir önceki satırdaki belge no ile eşit değilse grid satır yüksekliği 20 yoksa 15 (default yükseklik neyse o değer) yapardım
veya aynı karşılaştırmada renkleri değiştirirdim.
Ben şöyle bir kod buldum uyarladım ama renklendirme yapmadı.
if StokKontrol.FieldByName('FISNO').AsString = DBGrid3.DataSource.DataSet.FieldByName('FISNO').AsString Then begin DBGrid3.Canvas.Font.Color:=clWhite; DBGrid3.Canvas.Brush.Color:=clBlack; end; if DataCol = 0 then DBGrid3.DefaultDrawColumnCell(Rect, DataCol, Column, State); end;
(26-04-2022, Saat: 09:14)hi_selamlar Adlı Kullanıcıdan Alıntı: Merhabalar,
Umarım yardımcı olur.
https://www.db-fiddle.com/f/gTA8wWrZ8h278FhkxpWE5N/0
Kolay gelsin.
cREATE TABLE IF NOT EXISTS deneme ( id INT AUTO_INCREMENT PRIMARY KEY, belge_no VARCHAR(255) NOT NULL ) ENGINE=INNODB; insert into deneme (belge_no) values ('ABC123'),('ABC123'),('ABC124'),('ABC125'),('ABC125'); SELECT case id is not null when true then id else null end as id, case id is not null when true then belge_no else null end as belge_no FROM deneme group by belge_no, id with rollup having belge_no is not null
Teşekkür ederim. Uyarlayıp kullandım ama hata veriyor
SELECT case STOK_KODU IS NOT NULL when true then STOK_KODU else null end as STOK_KODU, case STOK_KODU IS NOT NULL when true then FISNO else null end as FISNO FROM TBLSTHAR group by FISNO, STOK_KODU with rollup having FISNO is not null
Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'IS'.
Msg 319, Level 15, State 1, Line 8
Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon.
Çalışan kod burada 1. satırı farkı renk 2. satırı farklı kaydet olarak yaptım
bu değiştirerek kendine göre uyarla
procedure Tmusterifrm.grid_musteriDrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); begin if data_form.musteri_sorgu.RecNo and 1 = 1 then begin grid_musteri.Canvas.Brush.Color:=$009BE3FF; grid_musteri.DefaultDrawColumnCell(Rect, DataCol, Column, State); end else begin grid_musteri.Canvas.Brush.Color:=clwhite; grid_musteri.DefaultDrawColumnCell(Rect, DataCol, Column, State); end; if gdSelected in State then grid_musteri.Canvas.Brush.Color := $00FDC7AA; grid_musteri.DefaultDrawColumnCell(Rect, DataCol, Column, State); end;
"…De ki: "Hiç bilenlerle bilmeyenler bir olur mu? Şüphesiz, temiz akıl sahipleri öğüt alıp-düşünürler" (Zümer Suresi, 9)

