Link to home
Start Free TrialLog in
Avatar of visionetv
visionetvFlag for United States of America

asked on

Query results won't display in DBGrid using variable parameters

Hi Experts;

Using a Delphi 7 ADOQuery component my application displays data results using hard-coded values in the Query but apparently will not recognize the same values as variables converted to integers from two TEdit controls

Code snippet - OnClick Event...
Query1.Parameters.ParamByName('RegID').Value := StrToInt(Edit1.Text);
Query1.Parameters.ParamByName('BatNum').Value := StrToInt(Edit2.Text);
Query1.Open;

Code snippet from Query:
WHERE TenderEntry.BatchNumber = :BatNum AND Batch.RegisterID = :RegID
With the Parameters 'BatNum' and 'RegID' in Query1 no results are displayed in the Delphi DBGrid.

Using hard-coded values without Parameters the results display without issue.

Code snippet from Query:
WHERE TenderEntry.BatchNumber = 1 AND Batch.RegisterID = 1

I need help in getting the Query to recognize the variable parameters from the TEdit boxes.

Any thoughts or a solution will be greatly appreciated.

Thank you,
Visionetv
Avatar of Vitor Montalvão
Vitor Montalvão
Flag of Switzerland image

The query runs with error or just doesn't return rows?
Avatar of visionetv

ASKER

Query run without error, just won't display data in DBGrid. Hard-coded variables display without a problem
ASKER CERTIFIED SOLUTION
Avatar of visionetv
visionetv
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Value in the DB was the problem not the code.