Forum > Databases

SQLite to ZMSql

(1/3) > >>

scons:
Hi,

I want to convert a SQLite db I have to a ZMSql db, it should have a very simple master-relationship. The purpose is only for viewing not altering the data itself.

I can not seem to find the right settings, when I set (see attached example) ZMQueryDataSet2: MasterSource to DataSource1 I get an error:  ZMQueryDataSet2: Field not found: "".

Can someone enlighten me what I do wrong ?

Thanks

mangakissa:
Why 'upload' your dataset to ZMsql? It's a great tool voor using textfiles. But as your TSQLQuery it related to TBufdataset and works in your memory.

--- Quote ---The purpose is only for viewing not altering the data itself.

--- End quote ---
That's a developping fault. Go to the property options of TDBGrid and select option dgRowSelect (http://forum.lazarus.freepascal.org/index.php?topic=2794.0). If your dataset is set to readonly, modifications can not be made.

scons:
Thanks for you reply, unfortunately it has no effect to the issue.

This form is just a part of the application which is for viewing (and checking) on user side only, other parts do calculations on the db itself and do make changes in the db.

The idea is to get rid of third party application (in this case SQLite) and keep everything in 1 install. I was trying to follow the master-detail example included in the ZMSql demos but no succes so far. So I am missing something but can't figure out what exactly.

hmprof:

--- Quote from: scons on January 05, 2018, 04:26:07 pm ---I can not seem to find the right settings, when I set (see attached example) ZMQueryDataSet2: MasterSource to DataSource1 I get an error:  ZMQueryDataSet2: Field not found: "".

--- End quote ---

I ran the test. Indeed, I had the same error.  But this error only occurs in "Debug" mode ! in "Release" mode, everything works well, no errors. That's strange !


Test environment :
Lazarus 1.8.0 r56594 FPC 3.0.4 i386-win32-win32/win64
TZMSQL-0.1.20.1.zip   2017-12-30  (https://sourceforge.net/projects/lazarus-ccr/files/zmsql/)

balazsszekely:
Hi scons,

Use parameterized queries. Change the SQL for ZMQueryDataSet2 to:

--- Code: MySQL  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---SELECT   PHASE AS Phase,   PNR AS Pnr,   PROF AS Prof,   ASSDIM AS Assdim,   ASSWEIGHT AS Assweight,   LOAD AS LoadFROM   ldb3where LOAD = :pLOADNR
Then on ZMQueryDataSet1 afterscroll:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.ZMQueryDataSet1AfterScroll(DataSet: TDataSet);begin  ZMQueryDataSet2.Parameters.ParamByName('pLOADNR').AsString :=     ZMQueryDataSet1.FieldByName('LOAD').AsString;  ZMQueryDataSet2.QueryExecute;end;    
Please note I did not study your database structure, maybe you should pass something totally different as parameter, but the idea is same.

Navigation

[0] Message Index

[#] Next page

Go to full version