Page 1 of 1

query select with param bug?

Posted: Thu 04 Jun 2009 05:05
by kingson
dear all,

I want to use OraQuery to select something use param, but I found that it's no use. Please look at this cood:

Code: Select all

  //1. using param
  OraQuery1.SQL.Text:='select * from ttttxt002105 where t$kwd2=:KWD2';
  OraQuery1.Params.ParamByName('KWD2').AsString:='SFC000523';
  OraQuery1.Active:=True;
  ShowMessage(IntToStr(OraQuery1.RecordCount)); //RecordCount = 0

  //2. not use param
  OraQuery1.SQL.Text:='select * from ttttxt002105 where t$kwd2=''SFC000523''';
  OraQuery1.Active:=True;
  ShowMessage(IntToStr(OraQuery1.RecordCount)); //RecordCount = 1
I use Param and select nothing. At the same time, insert or update is no program.
It's that OraQuery's Bug?

Environment:
Delphi 7, XP SP3, Oracle 10g

Posted: Fri 05 Jun 2009 06:14
by kingson
I already found the answer. It's very simple, just set the DataType.
add this:

Code: Select all

OraQuery1.Params.ParamByName('kwd2').DataType:=ftFixedChar;
all done.

thanks all.