Forum > Database

TIP - Database new lookupfield with Zeos Access

(1/2) > >>

Eigil:
I've been trying to create a lookupfield in a grid for hours, and it works in design mode but when I run the program, I always got the error
 "Can not perform opration on an inactive dataset".
 I have searched online and in the forum and can see that more people have the same problem. I have not been able to find a solution online.
 I then tried to do a test in Delphi6 just as in Lazarus here an error occurred when I defined new lookupfield in design mode with ZQueryXX set
 to active = true if active = false then ok.
  I then do the test in Lazarus by setting ZQueryXX to false before "RUN" and put in my case ZQuery1.active = true and ZTable1.active = true in the FormCreate method.
 Then the lookupfield in the grid was ok. :) (Lazarus 1.6.4 and 1.8RC4)
I hope this can be used by other in the forum.
Thank you for all the help that can be found here. :D

GAN:
I've had those kinds of mistakes in my early days with Zeos and I don't remember what my mistake was. Could you show the code or attach the project?

Eigil:
 Yes no problem.
J have made a small example for test in a zip-file.
J use MySql as database and have export the example data in af file named "test.sql"
There is also a Word file "info" with screen cuts. Hope you can use it.

GAN:
I think, because I can't test it (no have MySql), you only need to make de connection like this:


--- 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.FormCreate(Sender: TObject);begin  ZConnection1.Connect;  ZQuery1.Active:=true;  ZQuery2.Active:=true;;end;    
BTW you also can use ZQuery1.Open instead ZQuery1.Active:=True (it's the same).

Eigil:
If it can help I have attach a example with sqlite-3.
Change the "LibraryLocation" in "ZConnection1" to the folder where you have the sqlite3.dll
for your machine WIN32 or WIN64.

Navigation

[0] Message Index

[#] Next page

Go to full version