Article View: borland.public.cppbuilder.database.ado
Article #1291Re: Searching on double precision fields
From: Mark Guerrieri
Date: Tue, 03 Aug 2004 16:32
Date: Tue, 03 Aug 2004 16:32
75 lines
3722 bytes
3722 bytes
Check out http://support.microsoft.com/default.aspx?scid=kb;en-us;320744 There is also a thread at http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=38bec0c2%40dnews&rnum=2&prev=/groups%3Fq%3DADO%2Bfilter%2Bdecimal%2Bseparator%2Blocale%26hl%3Den%26lr%3D%26ie%3DUTF-8%26selm%3D38bec0c2%2540dnews%26rnum%3D2 Also, the docs for the ADO Filter property states that 'For numbers, you can use decimal points, dollar signs, and scientific notation.' IMHO this is probably a good thing; a filter expression can be written using the English locale and should work regardless of the underlying locale of the OS, allowing a single, protable filter expression to be written. I think the best solution is to toggle the DecimalSeparator... Mark "Michele Santucci" <michele.santucci@celinavio.it> wrote in message news:410e908d@newsgroups.borland.com... > Oki thnx this can be a good fix... but well there's not a way to set it to > the proper local symbol ? > > "Mark Guerrieri" <mguerrieri@cmsgrp.com> ha scritto nel messaggio > news:410e625a$1@newsgroups.borland.com... > > In BCB6, the AnsiString(double) constructor internally calls FloatToStr, > > which uses the value of the global variable DecimalSeparator to represent > > the decimal point. Try something like this: > > > > double Value; > > char OldDecimalSeparator = DecimalSeparator; > > DecimalSeparator = '.'; > > DataSet1->Filter = "FloatField<=" + AnsiString( Value ); > > DecimalSeparator = OldDecimalSeparator; > > DataSet1->Filtered=true; > > > > Mark > > > > "Michele Santucci" <michele.santucci.nospam@nospam.celinavio.it> wrote in > > message news:410e51f0@newsgroups.borland.com... > > > I have a field of a record (MS Access MDB file) defined as double > > precision > > > I need to query it at runtime using the Filter Adodataset property > > > If I do something of this kind > > > > > > double Value; > > > DataSet1->Filter = "FloatField<=" + AnsiString( double ); > > > DataSet1->Filtered=true; > > > > > > I always got no result since the decimal separator in my local (italian) > > is > > > different from the default one of AnsiString. > > > And then if Value=10.3 the Filter property is set to "FloatField<=10,3" > > > If I try to execute the query manually using the original 10.3 notation > > the > > > query give the expected results. > > > > > > -- > > > ================================ > > > Michele Santucci > > > Software Development Manager > > > Celin Avio S.r.l. > > > Via Fontevivo, 21/M 19100 La Spezia > > > tel. +39-0187564080 > > > ================================ > > > > > > > > > > > >
Technical Details
Message-ID:
<410fbe25$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<410e51f0@newsgroups.borland.com> <410e625a$1@newsgroups.borland.com> <410e908d@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,5515ed52d6570b06 X-Google-Attributes: gid10698b,public X-Google-Language: ENGLISH,ASCII-7-bit Reply-To: "Mark Guerrieri" <mguerrieri@cmsgrp.com> From: "Mark Guerrieri" <mguerrieri@cmsgrp.com> Newsgroups: borland.public.cppbuilder.database.ado References: <410e51f0@newsgroups.borland.com> <410e625a$1@newsgroups.borland.com> <410e908d@newsgroups.borland.com> Subject: Re: Searching on double precision fields Date: Tue, 3 Aug 2004 12:32:38 -0400 Lines: 77 Organization: Creative Marketing Strategies X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 66.200.143.50 Message-ID: <410fbe25$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1091550757 66.200.143.50 (3 Aug 2004 09:32:37 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail