Won't Run Second Time

Charles Yeomans yeomans at desuetude.com
Fri Dec 30 11:39:13 CST 2005


On Dec 30, 2005, at 11:19 AM, Chuck Pelto 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().
>
> The dbDatabase.CreateStructure() is the Constructor() call in this 
> app. I did that based on the Lesson1 example (see Window1 Methods). 
> Moving that call to the Constructor will never have the Constructor 
> called.
>
> 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.]

If you want to use a VDatabase subclass, then you need the constructor 
always.  I confess that I have quit using that approach because of 
problems I encountered early in making the switch to v2.  I've found 
that it is enough for me to use a VDatabase object plus the 
VDatabase.Table functions.  I have a separate module in which I keep a 
method or two that creates the database structure.

--------------
Charles Yeomans



More information about the Valentina mailing list