Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Assignment of ParamByName.Value fails to set datatype
Fri, Dec 19 2008 2:25 AMPermanent Link

Magnus Rosendahl
I encountered an error when upgraded a Delphi project from D2007
(DBISAM426b3) to D2009 (DBISAM427b1).

Consider the following code snippet:

  //Query = TDBISAMQuery
  //sql = SELECT * FROM T WHERE F1=:P1 AND F2=:P2
  //WhereFields = array of string
  //WhereValues = array of Variant

  with Query do
  begin
    SQL.Clear;
    SQL.Add(sql);
    for i := Low(WhereFields) to High(WhereFields) do
      ParamByName(WhereFields[i]).Value := WhereValues[i];
    Open;
    ...
  end;

This code ran fine with 4.26 but gives an error in 4.27.

Exception EDatabaseError 'Query: Field 'F1' is of an unknown type.'

Problem is I assign a Variant to Param.Value, and the datatype is not
automatically set. I could of course solve this by checking the VarType
of the value to be assigned and then use the assignment function
AsInteger, AsString etc.

But since it worked in the previous DBISAM version I thought you might
want to look at it. I suspect the error is related to the fact that
variant strings are no longer varString by default but varUString.

Regards,
Magnus Rosendahl
Fri, Dec 19 2008 2:17 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Magnus,

<< But since it worked in the previous DBISAM version I thought you might
want to look at it. I suspect the error is related to the fact that variant
strings are no longer varString by default but varUString. >>

Yes, you are correct.  There will be a new DBISAM build out shortly that
will correct this.

--
Tim Young
Elevate Software
www.elevatesoft.com

Wed, Jan 7 2009 9:50 AMPermanent Link

Magnus Rosendahl
> << But since it worked in the previous DBISAM version I thought you might
> want to look at it. I suspect the error is related to the fact that variant
> strings are no longer varString by default but varUString. >>
>
> Yes, you are correct.  There will be a new DBISAM build out shortly that
> will correct this.

Thank you. Works properly in 4.27 build 2.

Magnus
Image