EVariantOverflowError

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
FredS
Posts: 272
Joined: Mon 10 Nov 2014 17:52

EVariantOverflowError

Post by FredS » Sat 24 Jan 2015 01:39

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;

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: EVariantOverflowError

Post by AlexP » Mon 26 Jan 2015 07:48

Hello,

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

FredS
Posts: 272
Joined: Mon 10 Nov 2014 17:52

Re: EVariantOverflowError

Post by FredS » Mon 26 Jan 2015 18:02

BigInt with Firebird 2.5.3

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: EVariantOverflowError

Post by ViktorV » Tue 27 Jan 2015 06:30

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.

FredS
Posts: 272
Joined: Mon 10 Nov 2014 17:52

Re: EVariantOverflowError

Post by FredS » Tue 27 Jan 2015 17:43

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...

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: EVariantOverflowError

Post by azyk » Wed 28 Jan 2015 10:17

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;

Post Reply