Type mismatch in expression in Delphi 7 on SQL append

Posted by Demonick on Stack Overflow See other posts from Stack Overflow or by Demonick
Published on 2010-04-11T11:35:04Z Indexed on 2010/04/11 11:43 UTC
Read the original article Hit count: 312

Filed under:
|

I have a code, that checks the current date when a form is loaded, performs a simple calculation, and appends a SQL in Delphi. It works on Windows 7 with Delphi 7, and on another computer with Xp, but doesn't on 3 other computers with Xp. When the form is loaded it shows a "Type mismatch in expression", and points to the line after the append. What could be the problem?

procedure TfmJaunumi.FormCreate(Sender: TObject);

 var d1, d2: TDate; 

 begin  d1:= Date;  d2:= Date-30;  With
 qrJaunumi do
         begin
         Open;
         SQL.Append('WHERE Sanem_datums BETWEEN' + #39 + DateToStr(d1) +
         #39 + 'AND' + #39 + DateToStr(d2) + #39);
         Active := True; 
         end; 
 end;

© Stack Overflow or respective owner

Related posts about delphi

Related posts about sql