Conversion Bit to String

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Posts: 92
Joined: Tue 16 Jun 2009 10:59
Location: Bielefeld, Germany

Conversion Bit to String

Post by invent » Wed 10 Oct 2018 16:35


i have a question to use Bit-Fields with Delphi 7 / UniDAC 4.5.9 on MS Sql-Server 2012:

I created a table:

Code: Select all

CREATE TABLE [dbo].[inv_WWS_Activity](
	[RecId] [char](32) NOT NULL,
	[inv_IsBilled] [bit] NULL, 
The Datafield "inv_IsBilled" contains 0 or 1. Then I use TUniQuery:

Code: Select all

select RecId, inv_IsBilled 
from inv_WWS_Activity'
where RECID = '12345'
I get a record and when I show the content of the bit-field with

Code: Select all

ShowMessage (MyQuery.FieldByName ('inv_IsBilled').AsString);
The result is "Wahr" (in englisch: true). But i expect '0' or '1'.

What can i do? Do I have to change an option?

Thanks in advance for any help.

Kind regards,
Gerd Brinkmann
invent GmbH

Posts: 3
Joined: Wed 04 Apr 2018 08:30

Re: Conversion Bit to String

Post by frickler » Mon 15 Oct 2018 07:21

Looks like datatype "bit" is mapped to "boolean". Which seems to make sense in your case, since "is_billed" is either true or false. How to change that mapping is described in the help file under "Using UniDAC - Data Type Mapping".

Post Reply