Forum > Database

filtered dbgrid

(1/1)

cryptid:
filter db grid not work


procedure TForm1.Edit1Change(Sender: TObject);
begin
       SQLQuery1.Filtered:=False;
       SQLQuery1.Filter:='name' + 'LIKE' + QuotedStr(Edit1.Text );
        SQLQuery1.Filtered:=True;
end;   

wp:
Without spaces around 'LIKE' the three parts in your filter text, 'name', 'LIKE', condition, will not be separate words.

Joek:
A small example: this works for me with LIKE ...
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TFOhlaseni.FilterKodChange(Sender: TObject);var sImput:string;begin    sImput:=FilterKod.Text;    DMOhlaseni.DSIBOhlaseni.Filtered := false;    DMOhlaseni.DSIBOhlaseni.Filter := 'KOD_OHLASENI LIKE ' + QuotedStr(sImput+'%');    DMOhlaseni.DSIBOhlaseni.Filtered := true;end;    

flori:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---SQLQuery1.Active:=false;SQLQuery1.SQL.Clear;SQLQuery1.SQL.Append('select * from log WHERE user LIKE '''+edit1.Text+'%''');SQLQuery1.Active:=true

Navigation

[0] Message Index

Go to full version