<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=text/html;charset=iso-8859-1 http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.7600.16588"></HEAD>
<BODY style="PADDING-LEFT: 10px; PADDING-RIGHT: 10px; PADDING-TOP: 15px"
id=MailContainerBody leftMargin=0 topMargin=0 CanvasTabStop="true"
name="Compose message area">
<DIV><FONT face=Calibri>Hi John and Colin</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>You both set me on the right track.</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>The project works with the datamodule listed
<U>after</U> the main form, which contains the data aware components, in the
Project\Options\Forms list.</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>Thanks for your help.</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>Bob</FONT></DIV>
<DIV style="FONT: 10pt Tahoma">
<DIV><BR></DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A title=johnkbird@paradise.net.nz
href="mailto:johnkbird@paradise.net.nz">John Bird</A> </DIV>
<DIV><B>Sent:</B> Saturday, July 03, 2010 4:47 AM</DIV>
<DIV><B>To:</B> <A title=delphi@delphi.org.nz
href="mailto:delphi@delphi.org.nz">NZ Borland Developers Group - Delphi List</A>
</DIV>
<DIV><B>Subject:</B> Re: [DUG] Windows 7</DIV></DIV></DIV>
<DIV><BR></DIV>
<DIV><FONT size=2 face=Arial>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.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>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.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>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</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>//read ini file and get settings.</FONT></DIV>
<DIV><FONT size=2 face=Arial>database1.connected:=true;</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>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.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>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.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>John</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT face=Calibri>Hi John</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>I set up the data aware components and datasets in
a trial project and everything worked fine.</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>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..</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>This worked well. So I am now pretty
certain it has something to do with the datamodule form itself
(DM1).</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>You suggested settings not being loaded at the correct
time. I would appreciate some idea of how to check this out. </FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>I could just rebuild the project on DM2, however that's
no guarantee that it won't happen again.</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>The ini file itself seems ok - at least to
me.</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>Bob</FONT></DIV>
<DIV style="FONT: 10pt Tahoma">
<DIV><BR></DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A title=johnkbird@paradise.net.nz
href="mailto:johnkbird@paradise.net.nz">John Bird</A> </DIV>
<DIV><B>Sent:</B> Thursday, July 01, 2010 5:24 PM</DIV>
<DIV><B>To:</B> <A title=delphi@delphi.org.nz
href="mailto:delphi@delphi.org.nz">NZ Borland Developers Group - Delphi List</A>
</DIV>
<DIV><B>Subject:</B> Re: [DUG] Windows 7</DIV></DIV></DIV>
<DIV><BR></DIV>
<DIV><FONT size=2 face=Arial>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.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>If you are still stuck let me know, I could try a
quick project - but I have D2007 not 2006.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>John</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT face=Calibri>Hi</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>I've just installed my BDS 2006 based project on Windows
7.</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>I have data aware components on a form communicating
with datasets and tables on a Data Module Form (DM1).</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>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.</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>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.</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>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.</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>It seems that the problem may lay in a
communication problem from the DM1 to
the components.</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>Is this possible??</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>Bob</FONT></DIV>
<P>
<HR>
<P></P>_______________________________________________<BR>NZ Borland Developers
Group - Delphi mailing list<BR>Post: delphi@delphi.org.nz<BR>Admin:
http://delphi.org.nz/mailman/listinfo/delphi<BR>Unsubscribe: send an email to
delphi-request@delphi.org.nz with Subject: unsubscribe
<P>
<HR>
<P></P>_______________________________________________<BR>NZ Borland Developers
Group - Delphi mailing list<BR>Post: delphi@delphi.org.nz<BR>Admin:
http://delphi.org.nz/mailman/listinfo/delphi<BR>Unsubscribe: send an email to
delphi-request@delphi.org.nz with Subject: unsubscribe
<P>
<HR>
<P></P>_______________________________________________<BR>NZ Borland Developers
Group - Delphi mailing list<BR>Post: delphi@delphi.org.nz<BR>Admin:
http://delphi.org.nz/mailman/listinfo/delphi<BR>Unsubscribe: send an email to
delphi-request@delphi.org.nz with Subject: unsubscribe
<P>
<HR>
<P></P>_______________________________________________<BR>NZ Borland Developers
Group - Delphi mailing list<BR>Post: delphi@delphi.org.nz<BR>Admin:
http://delphi.org.nz/mailman/listinfo/delphi<BR>Unsubscribe: send an email to
delphi-request@delphi.org.nz with Subject: unsubscribe</BODY></HTML>