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
visionetvAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Vitor MontalvãoMSSQL Senior EngineerCommented:
The query runs with error or just doesn't return rows?
0
visionetvAuthor Commented:
Query run without error, just won't display data in DBGrid. Hard-coded variables display without a problem
0
visionetvAuthor Commented:
Solved the problem. There was a null variable in a DB column that was part of the Query.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
visionetvAuthor Commented:
Value in the DB was the problem not the code.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.