Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Problem with TDBISamQuery and TDBISamDatabase
Wed, Jun 4 2008 9:04 AMPermanent Link

"Adam H."
[Moved from Binaries group where it was mis-posted]

Hi,

I'm having a wierd problem with one of my projects. The mainform has a
TDBISamdatabase and TDBISamsession component, along with a number of forms
that are created and destroyed as required.

These forms may have a number of queries and tables on them, which have all
worked fine, however I've designed a new form with a wierd problem.

Whenever the new form is created in runtime, it has no link to the
TDBISamdatabase component. The Query.Databasename property is populated, but
Query.Database = nil.

Once I run the query, the query 'links' to the database and all is fine.

The problem I have is that the query refers to a password protected table.
The TDBISamsession on my mainform already has the password assigned to it,
but because the query on this form is not linked to the database and
session - it asks me for the password first, before opening (and therefore
linking to the table).

This is the first time I've come across this problem. I've had no problems
with it in the past.

I've checked to make sure that the form and query is not created prior to
the mainform (so the link should be valid).

I've also checked to make sure that the mainform still exists.

Both the Databasename and Sessionname properties have been set at
designtime.

I'm stumpted as to what could be causing this. Has anyone an idea?

(Delphi 2007, dbisam 4.26b1)

Thanks & Regards

Adam.
Wed, Jun 4 2008 9:26 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Adam


>However, the sessionname for the query has already been set. (Sorry - should
>have mentioned that in original post).

>but because the query on this form is not linked to the database and
>session

Can you reconcile these two statements?

Roy Lambert [Team Elevate]
Wed, Jun 4 2008 6:56 PMPermanent Link

"Adam H."
Hi Roy,

>>However, the sessionname for the query has already been set. (Sorry -
>>should
>>have mentioned that in original post).
>
>>but because the query on this form is not linked to the database and
>>session
>
> Can you reconcile these two statements?

LOL - it does sound contradictory, but I'll explain further...

In designtime, both the databasename and sessionname properties are set on
the Query. In Runtime, when I break the code (Before opening the query) and
I view the following properties and get the relevant results below:

Query.databasename = db   // Was set in designtime
Query.sessionname = dbs   // Was set in designtime
Query.database = nil   //Is not linking

If I allow the query to open (and type in the password manually when the
dialog box appears), then

Query.database = {the database on the main form}

Therefore, I can't access Query.database.session either (to link to the
actual session) because the database isn't linked, even though the "names"
are set on the component in designtime.

The only think I can think of that may have caused something like this is if
the form that the query was on (or the query itself) was created before the
form that the database and session components are on, but that isn't the
case. (And the mainform that contains the session and database components is
only destroyed when the program closes).

Normally this wouldn't cause a problem anyway, except that the query is
asking for a password when it opens (for one of the tables), but it
shouldn't because I have added the password to the session component on the
main form previous (and also opened up the password protected table prior to
opening this query).

Thanks & Regards

Adam.
Wed, Jun 4 2008 11:08 PMPermanent Link

"Adam H."
Hi Roy,

Thanks for your help. I think I've found the problem - there were instances
in my application that could cause the initial .addpassword on my mainform
NOT to run, which in turn caused the query to ask for the session password
when opening.

I found the query.dbsession property - and it IS connecting to my mainform
prior to the query being opened - so all seems to be working fine there.
The fact that query.database = nil to start with seems to have nothing to do
with it, and it caused me to go on a wild goose chase.

Cheers

Adam.
Image