Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread Multiple Params on Load
Sat, Jun 1 2013 3:58 PMPermanent Link

NicoSteyn

Hi,

I am evaluating WEB and have come accross a problem that I have spent a full day on.  My load results are correct when I load with a single load parameter, but when I add a second LIKE parameter it returns non-matching records also.  This is where I am:

I have a Dataset:  Customers defined in the IDE Dataset Manager

Defined as Query:

SELECT * FROM Customers
WHERE COMPANYID = {COMPANYID='DefaultValue'}

I have the Customers1 TDataSet on my Form.  I also have TEdit:  edSearch on my form and TButton:  btnSearch

 Customers1.Params.Clear;
 Customers1.Params.Add('COMPANYID=''' + COMPANYID +'''');
 Database.Load(Customers1);

*** This returns the correct records ***
Here is my problem:

 Customers1.Params.Clear;
 Customers1.Params.Add('COMPANYID=''' + COMPANYID +'''');
 Customers1.Params.Add('NAME = ''' + Trim(edSearch.Text)+'%'+'''');
 Database.Load(Customers1);

This returns the same results as the first, including records that do not match my request.

I have tried the following when defining my query in the Dataset Manager:

SELECT * FROM CUSTOMERS
WHERE COMPANYID = {COMPANYID='DefaultValue'}
AND NAME = {NAME='DefaultValue'}

and various other combinations.

I have also tried the following as the second parameter:
 Customers1.Params.Add('NAME LIKE ''' + Trim(edSearch.Text)+'%'+'''');


I would appreciate any assistance here.
Sat, Jun 1 2013 4:13 PMPermanent Link

NicoSteyn

I managed to resolve, the issue was as follows:

I defined my Dataset in the Dataset Manager as:

SELECT * FROM CUSTOMERS
WHERE COMPANYID = {COMPANYID='DefaultValue'}
AND NAME LIKE {NAME = 'NameValue'}

Thanks!
Image