🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #933

DecimalSeparator float fields and Filter properties

#933
From: Michele Santucci
Date: Wed, 16 Mar 2005 10:26
57 lines
2752 bytes
Hello NG,

I'm using C++ Builder 6.0 Pro on Windows XP Pro Italian.
My application use an Access XP Database (Office XP Pro Italian).
I defined several datamodules, dataconnections, datasets, datasources and
anything works fine except for dataset filtering.
I settled up some search forms where I build filter values to set dataset 
Filter
property with.
In some case this filter string contains references to float field and 
obviously
float values entered via edit box or other input media.
I build the string I use some code of this kind:

    TComboSpinEdit *cseStartLongitude;

    [...]

    AnsiString asFilterString = " (Longitude<= " + FloatToStr( 
cseStartLongitude->Position ) + ")";

    [...]

    adodsEnvironment->Filter = asFilterString;
    adodsFiltered = true;


Obviously cseStartLongitude->Position property is defined as double.

In this case nothing works i.e. the query doesn't return values since the 
DecimalSeparator returned
in FloatToStr()  is misunderstood (as TousandSeparator) by the db engine.
Right now I found this solution:

    char OldDecimalSeparator = DecimalSeparator;
    DecimalSeparator = '.';
    AnsiString asFilterString = " (Longitude<= " + FloatToStr( 
cseStartLongitude->Position ) + ")";
    DecimalSeparator = OldDecimalSeparator;

But it's not a 'nice' (programmatically) solution and anyway it depends on 
db format, locale settings and
so on...

How can I avoid this? There's a way to discover what DecimalSeparator is 
used by the database engine?

-- 
Michele Santucci
===================
Celin Avio S.r.l.
Software Dev. Manager
--------------------------------------
tel. +390187564080
Via Fontevivo 21/M
19126 La Spezia
=================== 
Technical Details
Message-ID: <423809d9$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!news-FFM2.ecrc.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,89a6b5e17a7ef8d0,start
X-Google-Attributes: gid10698b,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Michele Santucci" <michele.santucci@celinavio.it>
Newsgroups: borland.public.cppbuilder.database.ado
Subject: DecimalSeparator float fields and Filter properties
Date: Wed, 16 Mar 2005 11:26:34 +0100
Keywords: DecimalSeparator, Filter, Float
Lines: 59
Organization: Celin Avio S.r.l.
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 62.94.122.236
Message-ID: <423809d9$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1110968793 62.94.122.236 (16 Mar 2005 02:26:33 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!news-FFM2.ecrc.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail