The stored procedure on the sql server is :
ALTER PROCEDURE [dbo].[sp_archive]
@p1 varchar(21)
AS
BEGIN
SET NOCOUNT ON;
SELECT * from audit where UpdateDate like '%@p1%'
END
UpdateDate is a varchar(21) field.
In Delphi I have :
procedure TForm5.cxButton1Click(Sender: TObject);
begin
DataModule2.Archive.Params.ParamByName('p1').AsString := datetostr(cxDateEdit1.Date);
DataModule2.Archive.Prepare;
DataModule2.Archive.ExecProc;
end;
And yet,if I select the date in the cxDateEdit1 of which data (date) exists in the audit table,nothing gets displayed. If I run the query on the sql server :
select * from AUDIT where UpdateDate like '%30.12.2017%'
the data is displayed. So I guess there's something wrong with the dateformat the cxdataedit is displaying. Even if I change the display and edit format of the cxdateedit to : dd.mm.yyyy still I can retrieve no data.What am I missing here ?
I also tried :
DataModule2.Archive.Params.ParamByName('p1').AsString := cxDateEdit1.Text;
but to no avail ...