Won't Run Second Time

Ed Kleban Ed at Kleban.com
Fri Dec 30 11:27:48 CST 2005




On 12/30/05 10:19 AM, "Chuck Pelto" <cbpelto at pcisys.net> wrote:

> Morning Charles,
> 
> On Dec 29, 2005, at 3:51 PM, Charles Yeomans wrote:
> 
>> I wonder if the problem isn't your use of dbDatabase.CreateStructure
>> ().  For subclasses of VDatabase, you build the database structure
>> in the constructor.  It looks like you call
>> dbDatabase.CreateStructure() after creating the database, but not
>> when the database is opened next time. Try eliminating the
>> CreateStructure call from the App.Open code, and instead move it
>> into cDatabase.Constructor.
 
> Do we have to use a constructor during an Open call to an already
> existing database? I was understood that an existing and valid
> database structure would be recognized on .Open().

I believe you may have confused the use of the term "constructor" here.  The
term constructor does not refer to a specific API call such as
dbDatabase.CreateStructure().   The term refers to either a method named
"constructor" or a method having the same name as the class in which it is
contained.  This method gets called when a new instance is created.

The question at hand then, is what API calls does one need to put inside of
a constructor... or somewhere else.
 

> Do we have to use a constructor during an Open call to an already
> existing database?

This makes no sense to me.  A question that would make sense to me is: "Do
we have to use a Vdatabase.Open call inside of a constructor method to open
an already existing database?"  To which the answer is "Yes, if you want to
use that database."

> I was understood that an existing and valid
> database structure would be recognized on .Open().

If you name the database in the Vdatabase.Open call, then yes it should
successfully open it.

> The dbDatabase.CreateStructure() is the Constructor() call in this
> app. 

Again, that makes no sense to me based upon my understanding of the term
"constructor"

> I did that based on the Lesson1 example (see Window1 Methods).
> Moving that call to the Constructor will never have the Constructor
> called.

I highly recommend you take one of the specific working examples in the
examples folder, retain its structure, and modify the specific tables and
fields that you need for your app.  That will have a much greater liklihood
of working than building from scratch based upon what you read in the
tutorial.
 
> I could be mistaken in my understanding of the Constructor(), but as
> I said, it was based on Lesson1. [Note: Another example of what Ed
> and I have been talking about regarding a need for better
> documentation.]

I happen to think that the examples serve as the best possible documentation
available at this point.
 
> Regards,
> 
> Chuck

Good luck!
--Ed




More information about the Valentina mailing list