Error Date/Time not implemented lazarus / 16-Databases ---------------------------------------------------------------------- BertH · 2011-03-06 15:38 Hi, I am trying to replace the VB and Access by a Lazarus ODBC application. I managed sofar, with the help of samples and answers in this Forum to retrieve data from the Access DB. Adding, deleting and updating I got working with text data but the moment I want to update a date field I get the message that Date/Time is not implemented. I could find similar problems in this Forum but no solution. I don't want to convert the dates into text because that makes sorting the dates difficult. Is there a way to use Date fields in Lazarus with ODBC? I am using version 0.9.28,2 Bert ---------------------------------------------------------------------- Lacak2 · 2011-03-07 09:41 Yes you must upgrade Lazarus/FPC Date and DateTime support for ODBC was added in 04/2009 by this patch: http://bugs.freepascal.org/view.php?id=13206 It is fixed in FPC 2.3.1 and above. ---------------------------------------------------------------------- BertH · 2011-03-07 11:31 Thanks for your reply. But being a beginning Lazarus user I wonder how I can apply these patches. Is there an instruction somewhere telling me how to apply them? Bert ---------------------------------------------------------------------- Lacak2 · 2011-03-08 05:59 There is IMO simpler way, download newer version of Lazarus/FPC from  left menu "Daily snapshots" or http://www.hu.freepascal.org/lazarus/ Lazarus + FPC 2.4.x ---------------------------------------------------------------------- BertH · 2011-03-08 16:53 I downloaded Lazarus + fpc 2.4.3 and when the compilation of my project failed, I tried 2.4.2. In both cases I can compile my project but after compilation I get the message "Transaction already active". I can not find an explanation for this error message. I assume I did something wrong. Thanks for your help, assume I have to wait for the official release including the Date/Time type in ODBC. I'll continue my experiments without the Date type. Bert ---------------------------------------------------------------------- Lacak2 · 2011-03-09 06:43 If you can post here complete compilable project with Access DB, which will show your error, I will look at it. ---------------------------------------------------------------------- BertH · 2011-03-09 16:33 I am not sure which file(s) you need. I can make a zip file of the complete directory without the exe and the backup file. That results in an 565 kB zip file, I saw that the max that can be attached is 128 kB. Can you indicate which files you don't need from the project directory? Thanks, Bert ---------------------------------------------------------------------- Lacak2 · 2011-03-10 05:38 All program files (*.pp, *.pas, *.lfm) and project (*.lpi, *.lpr) and database which you use or other sample database (*.mdb or what other extension you use). But make test program as simple as possible ... ideal one buton, which I click and error shows, so I can easy locate to code which causes error. ---------------------------------------------------------------------- BertH · 2011-03-10 10:37 I'll simplify my test so that it has one button only. To test if it then also produces the error in 2.4.3 and not in 2.2.4 I have to reinstall both versions again. Sofar I have been unable to install both version side by side. So I have to uninstall one before i can install the other. As soon as the simplification is ready and tested I will let you know. Thanks agin for your help and patience. Bert ---------------------------------------------------------------------- BertH · 2011-03-10 21:08 I stripped my test project of all but one button (new) to add a record with a date field. This compiled in 2.2.4 ok. It gave the error date not implemented when I tried to add a new record. In 2.4.3 at the end of the compilation it stopped with the error "transaction already active". I attached the 3 zip files. unit1.zip containing the database, .pas .lfm .lpi .lpr There was no .pp file. Project1.zip and project1(2).zip contain files that were requested while compiling the project. You did not ask for these but I included them because I could not compile the project in 2.4.3 I hope you have sufficient info with these files to find a solution. I started this project with an example I found in the Wiki. I gradually added pieces to it until I stumbled upon the date problem. Thanks in advance for your cooperation. Bert ---------------------------------------------------------------------- Lacak2 · 2011-03-11 06:50 So my test results are: FPC 2.2.4 - As expected "Parameter 0 is of type DateTime which is not supported yet." ... as I wrote DateTime was not supported by this version FPC 2.4.1 and FPC 2.5.1 - when I comment:   //SQLTransaction1.Active := True; //not applied to ms access(false)   //SQLTransaction1.StartTransaction;  all works ok ... explicit transactions are not supported by ODBC ATM, so you do not need start transactions ---------------------------------------------------------------------- BertH · 2011-03-11 08:47 Thanks a lot, your solution worked here also OK. I left it there because it was in the example I used as a base. With this result I can extend my exploration of Lazarus and ODBC to see if I can replace the MSAccess application I am using. Again thank you very much for your patience and help. Bert