Article View: borland.public.cppbuilder.database.multi-tier
Article #941YOU CAN'T HANDLE THE TRUTH!!! Locate and Date formats EXPOSED!!!
From: Mark Vejvoda
Date: Tue, 19 Sep 2000 00:00
Date: Tue, 19 Sep 2000 00:00
20 lines
1487 bytes
1487 bytes
Using locate in C++ Builder can be AGONIZING especially when the user has
some WACKED OUT regional settings like dd-MMM-yy in which LOCATE MERELY
PUKES ON! ShortDateFormat won't help you here either..... the solution.....
Instead of adding the TDateTime variable to your variant array, Pass it as a
formatted date string, but MAKE SURE you set ShortDateFormat to something
you can trust in your constructor like dd'/'mm'/'yyyy then ALSO set
Application->UpdateFormatSettings = false;
Now you can use the code below and it won't care what regional settings the
user swaps too.... VICTORY!!!!
Variant locvalues[3];
locvalues[0] = Variant(iEmpID);
locvalues[1] = Variant(dtExDate.FormatString(ShortDateFormat));
//Variant(dtExDate);
locvalues[2] = Variant(iExID);
bFoundShiftMatch =
cdsEmployeeSchedule->Locate("EmpID;Date;ReliefExceptionID",
VarArrayOf(locvalues, 2), TLocateOptions());
Technical Details
Message-ID:
<8q8ijr$15m10@bornews.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fcd2b,8f0f5c5f00a6f513,start X-Google-Attributes: gidfcd2b,public From: "Mark Vejvoda" <mvejvoda@soft-haus.com> Subject: YOU CAN'T HANDLE THE TRUTH!!! Locate and Date formats EXPOSED!!! Date: 2000/09/19 Message-ID: <8q8ijr$15m10@bornews.borland.com> X-Deja-AN: 671767552 X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Organization: Another Netscape Collabra Server User X-MSMail-Priority: Normal Newsgroups: borland.public.cppbuilder.database.multi-tier