I am using Delphi 7 and I have a table named Table_1
which has two fields say, IMageCode Varchar(50)
, ActImage [Blob in Oracle, VarBinary(Max) in SQL Server]
, it has four records inserted including images and respective image code.
When I write a SQL as below in Oracle:
Select * from Table_1 where Upper(ImageCode) ='SUNSET'
TADOQuery doesn't return any record, when I check TADOQuery.RecordCount
it shows 0
, when I try to see TADOQuery.IsEmpty
it says True
. Then same query when I execute in the Oracle editor it returns one record as expected, but in delphi the TADOQuery doen't return any record.
But when I write following simple sql for the oracle database, it returns all four records using TADOQuery:
Select * from Table_1
I don't find any issue in SQL server database, as discussed above using TADOQuery.
ADOConnection.Connected := False;
ADOConnection.LoginPrompt := False;
ADOConnection.ConnectionString := <Connection String>;
ADOConnection.Connected := True;
ADOQuery1.Connection := ADOConnection;
with ADOQuery1 do begin
Active := False;
SQL.Clear;
//SqL.Add('Select * from Table_1 where Upper(ImageCode) = ' + QuotedStr(Uppercase(Trim(edtImageCode.Text))));
SqL.Add('Select * from Table_1 where Upper(ImageCode) = ''SUNSET''');
Active := True;
end;
Could anybody put focus what could be the issue?
Issue is resolved, I tried making "ImageCode" as a primary key, and now TADOQuery is returning the peroper record count i.e. 1 as expected. Previously there was no primary key, but still, if there is primary key or not TADOQuery should return the required data sets.
Any guess ?