Board index » delphi » Param not working

Param not working

I have a query that won't execute:

select DESCRIPTION, PARTS_CAT, SP_TAX, UNIT_PRICE
from PARTS
where PART_NUM =:PART_NUM

The "PART_NUM" is typed into Edit1 then the enter key should perform the
query.

This is my code:

procedure TForm1.DBEdit1KeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #13 then begin
  IBDataSet1.Close;
  IBDataSet1.ParamByName('PART_NUM').AsString := Edit1.Text;
  IBDataSet1.Open;
end;
end;

Nothing happens when I hit the enter key. I tried using a DBEdit text box
instead but then I couldn't see the text I was typing.(It wouldn't show up
in the box.)

Jim

 

Re:Param not working


Hi!

Check if your KeyPreview property of your form is set to true

HTH

VB

Re:Param not working


Yeah, it's true. I think that the reason I can't type in the DBEdit boxes is
because I haven't set an insert query. I don't want/need an insert
query(this is straight data lookup)

Can I get a param from a plain Edit text box? Do I need to do any TextToStr
sort of thing?

Jim

Quote
"Vincent Bergeron" <i...@vincentbergeron.com> wrote in message

news:3c8839ac_2@dnews...
Quote
> Hi!

> Check if your KeyPreview property of your form is set to true

> HTH

> VB

Re:Param not working


Quote
James Wharton wrote:

> Yeah, it's true. I think that the reason I can't type in the DBEdit boxes is
> because I haven't set an insert query. I don't want/need an insert
> query(this is straight data lookup)

Then don't use DBEdits.  Just use TEdits.

Quote

> Can I get a param from a plain Edit text box? Do I need to do any TextToStr
> sort of thing?

No you don't need anything like that, Edit1.Text is a string.

Quote

> Jim

--
Jeff Overcash (TeamB)
      (Please do not email me directly unless  asked. Thank You)
This sad little lizard told me that he was a brontosaurus on his mother's
side.  I did not laugh; people who boast of ancestry often have little else
to sustain them.  Humoring them costs nothing and adds to happiness in
a world in which happiness is in short supply.   (RAH)

Other Threads