Page 1 of 1

EVariantOverflowError

Posted: Sat 24 Jan 2015 01:39
by FredS
Hi, got this error while trying to use UniQuery Params..


Using UniDac v6.0.2 Delphi XE7 Update 1

---------------------------
Debugger Exception Notification
---------------------------
Project PA.exe raised exception class EVariantOverflowError with message 'Overflow while converting variant of type (LongWord) into type (Integer)'.

var
v: variant;
begin
Query.Active := False;
Query.sql.text := 'Select * from Servers where iD = :ID';
V := 3758096384;
Query.ParamByName('ID').Value := V;
Query.Open;
end;

Re: EVariantOverflowError

Posted: Mon 26 Jan 2015 07:48
by AlexP
Hello,

Please specify the field type and the name of the DB your are working with.

Re: EVariantOverflowError

Posted: Mon 26 Jan 2015 18:02
by FredS
BigInt with Firebird 2.5.3

Re: EVariantOverflowError

Posted: Tue 27 Jan 2015 06:30
by ViktorV
Unfortunately, we could not reproduce the issue. Please send a small sample to demonstrate the issue to viktorv*devart*com, including a script to create and fill in the test database object.

Re: EVariantOverflowError

Posted: Tue 27 Jan 2015 17:43
by FredS
My mistake this only happens on SQL-Server, using 2008R2 the column is declared as:

Code: Select all

CREATE TABLE PA.dbo.SERVERS (
  ID BIGINT IDENTITY,
ViktorV wrote:Unfortunately, we could not reproduce...

Re: EVariantOverflowError

Posted: Wed 28 Jan 2015 10:17
by azyk
We have reproduced the specified error. We will investigate such behavior and inform you about the results.

To solve the problem, set explicitly the parameter data type to ftLargeint. For example:

Code: Select all

var
  v: variant;
begin
  Query.Active := False;
  Query.sql.text := 'Select * from Servers where iD = :ID';
  V := 3758096384;
  Query.ParamByName('ID').DataType := ftLargeint; // set parameter data type   
  Query.ParamByName('ID').Value := V;
  Query.Open;
end;