----- Original Message -----
Sent: Wednesday, August 28, 2002
10:18 AM
Subject: [DUG]: weird behavour with
Format
I have struck some weird
behaviour:
We use "Format" to format SQL Strings - this
usually works (has so far, used three times) ...
The following code will not work if contained
inside the "with" statement - and it is only setting a local variable
!!!
I can't see or understand why ?
I have the same constructs in other parts of
my code - all working fine
- I have checked the TIBQueries,
they are identical apart from SQLString, SQLParameters, and
Name.
- I even copied 1 across and used it -
same result!
This should not affect the assigning of a
local variable ...
I am avoiding the "with" (it all works) but I
would love to know why and if anyone else has come across this
?
procedure MyProcedure
...
const
csString = 'This is
an example string '
+
'this %s
string '
+
'is
a test';
var
TestString: String;
ResultString:
String;
begin
TestString :=
'Blah Blah Blah;
with qryMyQuery do
begin
ResultString := Format(csString,
[TestString]); // Inserts ''
end;
ResultString :=
Format(csString, [TestString]); // Inserts 'Blah Blah
Blah'
end;
Regards
Paul McKenzie
Analyst
Programmer
SMSS
Ltd.