MS SQL Negative SmallInt appears as 65535 in TIntegerField

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Posts: 1
Joined: Thu 03 Mar 2011 20:12

MS SQL Negative SmallInt appears as 65535 in TIntegerField

Post by mosest » Thu 03 Mar 2011 20:23

We have legacy Delphi code that was written against Oracle. We now also support SQL Server.

The problem is that negative values, like -1, in SQL Server SmallInt columns appear as the value 65535 in the GUI when associated to a Delphi TIntegerField.

If we change the TIntegerField a TSmallInt field everything works as expected.

Since we have hundreds of TIntegerField, some of which should remain integers, is there an option, or global setting on the Uni Connection/Uni Query, we can use to avoid having to change some of our TIntegerFIelds to TSmallInt fields?


Post by AndreyZ » Fri 04 Mar 2011 10:04


Unfortunately, the only way to avoid this problem is to map smallint columns to TSmallintField. You can look at the TIntegerField.GetValue method in the DB unit to understand the reason of this problem.

Post Reply