We help IT Professionals succeed at work.

Translate Error. Value out of bounds.

ivylnm
ivylnm asked
on
Medium Priority
2,833 Views
Last Modified: 2007-11-27
I encounter this problem whenever it reached the function involving date such as SQL like this "select * from TABLE where PDate = :pdate" and after parambyname, it would show this error message. Please guide.

p/s:  Actually I don't know that whether it is affected by the installation of Delphi 6 in my computer.
Comment
Watch Question

Commented:
ivylnm,

If this is a date value, SQL expects to see this as a string value in the format of 'MM/DD/YYYY' (including the quotes). Otherwise, it will attempt to calculate the value of the date as a numeric value!

To remedy this, try the following:

var
 sDate: string;
begin
...
sDate:= #39 + FormatDateTime('mm/dd/yyyy', DateValue) + #39;
SQL.Text := 'SELECT * FROM PTABLE WHERE PDate = ' + sDate;
...
end;

Where sDate will be set to the correct format, with DateValue being the TDateTime you wish to convert.

Hope that helps!