Thread View: borland.public.cppbuilder.database.ado
1 messages
1 total messages
Started by Michele Santucci
Wed, 16 Mar 2005 10:26
DecimalSeparator float fields and Filter properties
Author: Michele Santucci
Date: Wed, 16 Mar 2005 10:26
Date: Wed, 16 Mar 2005 10:26
57 lines
2752 bytes
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
===================
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads