[DUG] Windows 7

Bob Pawley rjpawley at shaw.ca
Sun Jul 4 07:49:16 NZST 2010


Hi John and Colin

You both set me on the right track.

The project works with the datamodule listed after the main form, which contains the data aware components, in the Project\Options\Forms list.

Thanks for your help.

Bob


From: John Bird 
Sent: Saturday, July 03, 2010 4:47 AM
To: NZ Borland Developers Group - Delphi List 
Subject: Re: [DUG] Windows 7


What I was meaning was more on the lines of a project I worked on where problems came from the database connection details came from an ini file, but because the main form or the datamodule were created before the ini file was read and the database.connected was set to true, it got the wrong settings (eg a blank or invalid connection string) and an error message like you said.

In particular I got fooled by a subsidiary form that was not shown or opened before the error was one of the culprits, because the database connection was actually running in that form create event at program start - so I didn't at first realise that was the (not yet shown) form creating the trouble.

The solution in that case was to not have the database connected until all relevant settings (connection string etc) were loaded.   Involved some detective work to find the order that forms were created and various events ran that read the ini file, having database1.connected:=false in the form/datamodule, and putting code like

//read ini file and get settings.
database1.connected:=true;

What Colin said rings a bell too - I have seen a project where the order of the datamodules and the forms were quite particular (in the project file) - All the datamodules were created before any forms were autocreated.

I have also heard others say that sometimes when components such as datasources/querys/datasets are copied and pasted, and then their names and other details changed, on rare cases they might seem to have phantom settings that confuse (eg params might not  get set right in the dataset or unexpected field definitions) and the simplest solution is to delete and create them again fresh.   This case you could also find probably looking at the dfm as text.

John

Hi John

I set up the data aware components and datasets in a trial project and everything worked fine.

I then created a second datamodule (DM2) within the original project and copied the dataset and table to it, then connected the data aware components from the main form..

This worked well. So I am now pretty certain it has something to do with the datamodule form itself (DM1).

You suggested settings not being loaded at the correct time. I would appreciate some idea of how to check this out. 

I could just rebuild the project on DM2, however that's no guarantee that it won't happen again.

The ini file itself seems ok - at least to me.

Bob


From: John Bird 
Sent: Thursday, July 01, 2010 5:24 PM
To: NZ Borland Developers Group - Delphi List 
Subject: Re: [DUG] Windows 7


I have D2007 on Windows 7, as far as I know I haven't used a Data module on yet.   However I have used a data module in a project running inside a VMWare XP virtual PC on the Windows 7 box definitely with no problem accessing databases.   I do recall that the 'Database Not Set'  might be caused by some settings (loaded from an ini file) not yet being in place when the Form Create runs, so you might want to make sure this is not what is behind it.   I had similar problems which were due to that.

If you are still stuck let me know, I could try a quick project - but I have D2007 not 2006.

John

Hi

I've just installed my BDS 2006 based project on Windows 7.

I have data aware components on a form communicating with datasets and tables on a Data Module Form (DM1).

I have no problem when the database is empty. I can compile the project, enter information into the databases and close the project and the information is distributed properly.

However, when I attempt to re-open the project (with the database containing information) it gives me a 'database not set' error and fails to compile.

When I move the dataset and table to the component form and reconnect them to the components on the same form, the project compiles and I can add and delete information and re-compile with no problem.

It seems that the problem may lay in a communication problem from the DM1 to the components.

Is this possible??

Bob


--------------------------------------------------------------------------------


_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi at delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject: unsubscribe 


--------------------------------------------------------------------------------


_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi at delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject: unsubscribe 


--------------------------------------------------------------------------------


_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi at delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject: unsubscribe 


--------------------------------------------------------------------------------


_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi at delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject: unsubscribe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20100703/783e8c0c/attachment-0001.html 


More information about the Delphi mailing list