Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Dynamic Engine and persistent fields
Tue, Jan 1 2013 12:58 AMPermanent Link

Peter

Happy New Year.

I had some help from the forum with regard to not using an Engine component, and it all went swimmingly. The code looks like this:
Engine.Active      := False;
Engine.Name        := 'EDBEngine';
Engine.UseLocalSessionEngineSettings := True;
Engine.TempTablesPath   := Engine.GetTempTablesPath;
MyDatabase              := TEDBDatabase.Create(Self);
MyDatabase.DatabaseName := sDBName;
MyDatabase.Database     := sDB;
Sess                    := TEDBSession.Create(Self);
Sess.LoginUser          := 'Administrator';
Sess.LoginPassword      := 'EDBDefault';
etc,

But I can't see how to add persistent fields, as the Engine settings are all done in code, not in the DFM file. Specifically, if I drop an EDBQuery on a form\Data module, assign the Session to Default, then double-click on the component to add the fields, I get a message saying "Error #409, the configuration path is empty".

If I wish to use persistent fields should I revert to using an EDBEngine component?

Regards & TIA
Tue, Jan 1 2013 5:11 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Peter

> Engine.UseLocalSessionEngineSettings := True;

This line tells the engine to use the session's properties. It defaults to false. The only way you can alter that in the IDE is to have an engine component on the form or hack the source.

Then if you want to be able to open tables in the IDE (eg to get the fields) you also need a session component with its properties set.

>If I wish to use persistent fields should I revert to using an EDBEngine component?

Yes and a session and database component unless you want to define all the fields manually. If you're willing to do that:

1. drop table component on form
2. double click table component (this brings up the field editor)
3. ctrl-n brings up a dialog to create a new field (lots of typing needed)

It will work but I much prefer a datamodule containing the engine, session and databases then its:

1. drop table component on form
2. set sessionname
3. set databasename
4. double click
5. ctrl-f = all fields defined.

Roy Lambert [Team Elevate]
Sat, Jan 5 2013 11:04 PMPermanent Link

Peter

Thanks Roy, I'll do that. I shied away from persistent fields, but there are some queries that would benefit from either using a bunch of local vars, or just using persistent fields.

Regards
Image