artem_niko Posted May 8, 2022 Share Posted May 8, 2022 Hello! I'm trying filtering record in UniDBGrid, as in demo ...\Framework\uniGUI\Demos\Desktop\GridFiltering But, I'm using FireDAC, not ADO. This is my code in UniDBGrid: procedure TUniFrameG0.UniDBGrid1ColumnFilter( Sender: TUniDBGrid; const Column: TUniDBGridColumn; const Value: Variant); begin if FDQuery1.Active then begin FDQuery1.Close; FDQuery1.Params.ParamByName(Column.FieldName).Value := '%' + Value + '%'; FDQuery1.Open; end; end; And created param in FDQuery: But, this is not working and I get error: FDQuery1: Parameter 'OV_08' not found. How right using FDQuery for filtering records, as ADOQuery from demo? Quote Link to comment Share on other sites More sharing options...
Oliver Morsch Posted May 8, 2022 Share Posted May 8, 2022 Can you Show your SQL query? Quote Link to comment Share on other sites More sharing options...
artem_niko Posted May 8, 2022 Author Share Posted May 8, 2022 2 hours ago, Oliver Morsch said: Can you Show your SQL query? I'm using stored procedure for select records from database: procedure TUniFrameG0.UniDBGrid1ColumnFilter(Sender: TUniDBGrid; const Column: TUniDBGridColumn; const Value: Variant); begin if FDConnection1.Connected = True then begin FDQuery1.Close; FDQuery1.SQL.Clear; FDQuery1.SQL.Text:='SELECT * FROM Procedure04'; FDQuery1.Params.ParamByName(Column.FieldName).Value := '%' + Value + '%'; FDQuery1.Open; end; end; I'm not use SQL property FDQuery from design, only runtime... How this using stored procedure in FDQuery, as in demo? Quote Link to comment Share on other sites More sharing options...
Oliver Morsch Posted May 8, 2022 Share Posted May 8, 2022 I have not much experience with stored procedures, but normally - when using parameters - in SQL there should be the used parameter declared: select * from procedure04 where MyFieldName = :MyFieldName Quote Link to comment Share on other sites More sharing options...
artem_niko Posted May 8, 2022 Author Share Posted May 8, 2022 4 minutes ago, Oliver Morsch said: I have not much experience with stored procedures, but normally - when using parameters - in SQL there should be the used parameter declared: select * from procedure04 where MyFieldName = :MyFieldName Whell...I'm using stored procedures... 4 minutes ago, Oliver Morsch said: select * from procedure04 where MyFieldName = :MyFieldName One query for all parameters? ... where MyFieldName=:MyFieldName, MyFieldName2=:MyFieldName2...? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 8, 2022 Share Posted May 8, 2022 Hello, You can simple use Filter property of your DataSet. Quote Link to comment Share on other sites More sharing options...
artem_niko Posted May 8, 2022 Author Share Posted May 8, 2022 2 minutes ago, Sherzod said: Hello, You can simple use Filter property of your DataSet. How? Not understanding Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 8, 2022 Share Posted May 8, 2022 https://docwiki.embarcadero.com/Libraries/Sydney/en/FireDAC.Comp.Client.TFDQuery.Filter Quote Link to comment Share on other sites More sharing options...
artem_niko Posted May 8, 2022 Author Share Posted May 8, 2022 1 minute ago, Sherzod said: https://docwiki.embarcadero.com/Libraries/Sydney/en/FireDAC.Comp.Client.TFDQuery.Filter I know about this property. But, on you link is very small information... I was thinking, will be anouthe replace ADOQuery on FDQuery and some changing code and this is all Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 8, 2022 Share Posted May 8, 2022 23 minutes ago, artem_niko said: I know about this property. Basically I use this property (Filter). Quote Link to comment Share on other sites More sharing options...
artem_niko Posted May 8, 2022 Author Share Posted May 8, 2022 23 minutes ago, Sherzod said: Basically I use this property (Filter). It turns out that if I create a personal parameter for each field and write in the FDQuery.Filter property something like (Field1 like %:Param1%) and (Field2 like %:Param2%)... then it will work with the property FDQuery.Filtered=True and calling my stored procedure that calls a SELECT query? Quote Link to comment Share on other sites More sharing options...
Abaksoft Posted May 9, 2022 Share Posted May 9, 2022 18 hours ago, artem_niko said: It turns out that if I create a personal parameter for each field and write in the FDQuery.Filter property something like (Field1 like %:Param1%) and (Field2 like %:Param2%)... then it will work with the property FDQuery.Filtered=True and calling my stored procedure that calls a SELECT query? Hello, Can you try : http://forums.unigui.com/index.php?/topic/18946-how-to-use-unicombobox-in-unidbgrid/&do=findComment&comment=107950 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.