LocateEx with lxNearest problem with dates
-
NoComprende
- Posts: 135
- Joined: Tue 09 Jan 2007 13:44
LocateEx with lxNearest problem with dates
Doesn't work properly with dates e.g. if I search for the nearest to the 30/12/2001 it lands on 31/01/1995 when it should land on 01/01/2002 (there's no 30th or 31st of Dec 2001 in the table). It seems to be working in alphabetical order according to the date format.
-
NoComprende
- Posts: 135
- Joined: Tue 09 Jan 2007 13:44
I could not reproduce the problem.
Please send me a complete small sample to dmitryg*devart*com to demonstrate it, including a script to create and fill table.
Also supply me the following information:
- the exact version of MyDAC. You can see it in the About sheet of TMyConnection Editor;
- the exact version of your IDE.
Please send me a complete small sample to dmitryg*devart*com to demonstrate it, including a script to create and fill table.
Also supply me the following information:
- the exact version of MyDAC. You can see it in the About sheet of TMyConnection Editor;
- the exact version of your IDE.
-
NoComprende
- Posts: 135
- Joined: Tue 09 Jan 2007 13:44
CREATE TABLE `Dates` (
`ADate` DATE NOT NULL,
PRIMARY KEY (`ADate`)
);
insert into Dates values (20070707), (20080101), (20090101);
Put a TMyQuery (SQL->Text = "select * from Dates") or TMyTable (Table="Dates") on to a C++ Builder form or DataModule, set IndexFieldNames = "ADate", set Active = true then link the following code to a TButton, put a breakpoint on line 1 and a Watch on Dates->RecNo.
Dates->LocateEx("ADate","31/12/2008",TLocateExOptions()LocateEx("ADate","20081231",TLocateExOptions()<<lxNearest);
After execution of line 1 the RecNo is still 1 and nothing changes when executing Line 2.
I'm using rad studio 2009 and MyDAC 5.70.0.43. I'd pay to update to the latest version of MyDAC if there was an easy way of doing so and of finding the newest version. You did say you were going to rectify the mess that is called the 'registered users area' which has so many different addresses and passwords (which don't even show the latest version or when the subscription is up) but I've heard no word on that.
`ADate` DATE NOT NULL,
PRIMARY KEY (`ADate`)
);
insert into Dates values (20070707), (20080101), (20090101);
Put a TMyQuery (SQL->Text = "select * from Dates") or TMyTable (Table="Dates") on to a C++ Builder form or DataModule, set IndexFieldNames = "ADate", set Active = true then link the following code to a TButton, put a breakpoint on line 1 and a Watch on Dates->RecNo.
Dates->LocateEx("ADate","31/12/2008",TLocateExOptions()LocateEx("ADate","20081231",TLocateExOptions()<<lxNearest);
After execution of line 1 the RecNo is still 1 and nothing changes when executing Line 2.
I'm using rad studio 2009 and MyDAC 5.70.0.43. I'd pay to update to the latest version of MyDAC if there was an easy way of doing so and of finding the newest version. You did say you were going to rectify the mess that is called the 'registered users area' which has so many different addresses and passwords (which don't even show the latest version or when the subscription is up) but I've heard no word on that.
-
NoComprende
- Posts: 135
- Joined: Tue 09 Jan 2007 13:44
Note
Dates->LocateEx("ADate","01/01/2009",TLocateExOptions()LocateEx("ADate","01/01/2009",TLocateExOptions());
does move the cursor to record 3.
Also note
Dates->LocateEx("ADate","20091231",TLocateExOptions()LocateEx("ADate","20091231",TLocateExOptions());
raises a 'not a valid date' exception.
My windows date settings are in the dd/mm/yyyy format.
Dates->LocateEx("ADate","01/01/2009",TLocateExOptions()LocateEx("ADate","01/01/2009",TLocateExOptions());
does move the cursor to record 3.
Also note
Dates->LocateEx("ADate","20091231",TLocateExOptions()LocateEx("ADate","20091231",TLocateExOptions());
raises a 'not a valid date' exception.
My windows date settings are in the dd/mm/yyyy format.
The point is that when you use the lxNearest location option, the compared values have the same type as the KeyValues parametes does. In your case values are compared in text format. Therefore the search is done unpredictably.
To solve this problem you should specify the parameter type equal to the date type, like this:
To solve this problem you should specify the parameter type equal to the date type, like this:
Code: Select all
Dates->LocateEx("ADate", StrToDate("31/12/2008"),TLocateExOptions()<<lxNearest);-
NoComprende
- Posts: 135
- Joined: Tue 09 Jan 2007 13:44
Sorry for the inconvenience, but we have not modified our Registered Users' Area yet.
To learn if your Subscription has expired, please contact our sales department (sales*devart.com).
If your Subscription has expired, you can renew it on the Ordering page (http://www.devart.com/mydac/ordering.html)
To learn if your Subscription has expired, please contact our sales department (sales*devart.com).
If your Subscription has expired, you can renew it on the Ordering page (http://www.devart.com/mydac/ordering.html)
-
NoComprende
- Posts: 135
- Joined: Tue 09 Jan 2007 13:44
This is what my previous diatribe on the 'Registered Users Area(s)' was all about Dimon. I only know my subscription has expired and what edition I subscribed to because I kept the email you sent 18 months ago. When I tried to upgrade my MYDAC version last year and was unable to do so I was told my subscription must have ran out even though it had 3 months to run. You have some great products at Devart but having parallel users areas spread all over the web (that contain no details on when subscriptions run out) with different passwords and versions attached does devart or us no favours.Devart wrote:Sorry for the inconvenience, but we have not modified our Registered Users' Area yet.
To learn if your Subscription has expired, please contact our sales department (sales*devart.com).
If your Subscription has expired, you can renew it on the Ordering page (http://www.devart.com/mydac/ordering.html)
-
NoComprende
- Posts: 135
- Joined: Tue 09 Jan 2007 13:44
I've went to the ordering page and when I clicked on 'Professional Edition Subscription' I'm asked if I want to also order dbForge Studio with a 30% discount for an additional £94.23 which I was tempted to do but I then noticed I get a copy of dbForge Studio if I take the Professional to Developer upgrade at £33.63. Am I missing something or was I nearly ripped off for £60?
dbForge Fusion vs dbForge Studio
With MyDAC Developer Edition you get dbForge Fusion for MySQL. dbForge Fusion for MySQL is an add-in designed to simplify MySQL database development and enhance data management capabilities. You can integrate dbForge Fusion for MySQL into Microsoft Visual Studio or CodeGear RAD Studio. It serves for exploring and maintaining existing databases, designing compound SQL statements and queries, and manipulating data in different ways.
dbForge Studio for MySQL is an administration tool and development environment for working with MySQL databases. It serves for exploring databases, managing schema objects, setting user accounts and privileges, developing stored routines, and synchronizing data between databases.
dbForge Studio for MySQL is an administration tool and development environment for working with MySQL databases. It serves for exploring databases, managing schema objects, setting user accounts and privileges, developing stored routines, and synchronizing data between databases.
-
NoComprende
- Posts: 135
- Joined: Tue 09 Jan 2007 13:44
-
NoComprende
- Posts: 135
- Joined: Tue 09 Jan 2007 13:44