Board index » delphi » BDE database problem.

BDE database problem.

On Fri, 09 Aug 2002 10:08:33 +0200, Markku Nevalainen <m...@iki.fi>
wrote:

Quote
>I don't quite understand this, there is no problem if you try
>to close an already closed table/query, or vice versa.
>This kind of code runs fine, and does not do any harm:

>procedure TForm1.Button1Click(Sender: TObject);
>begin
>  Query1.Open;
>  Query1.Open;

>  Query1.Close;
>  Query1.Close;

>  Table1.Open;
>  Table1.Open;

>  Table1.Close;
>  Table1.Close;
>end;

>Also I don't know what would be the basic difference between
>    Table1.Close and
>    Table1.Active := False;

>By a quick look inside VCL code, Close seems to call just the same
>closing procedures as Active := False does.

> procedure TSession.Close;
> begin
>   SetActive(False);
> end;

>I regularly use Table1.Close/Open and Query1.Close/Open expressions
>everywhere, because they are a few characters shorter to write:)

Hi Markku,
I don't know. I base this on what the revered Steve Koterski once
wrote while he was still with Borland. I did not go into it, just
followed his advice, and never had a problem.
I simply passed on his advice.
Best Regards
Johan Smit
 

Re:BDE database problem.


Quote
smi...@mweb.co.za wrote:

> I don't know. I base this on what the revered Steve Koterski once
> wrote while he was still with Borland. I did not go into it, just
> followed his advice, and never had a problem.

I also have read quite _some_ of Koterski's postings, but I don't
remember seeing that kind of message. I wonder where is Koterski now
a days. If I remember it right, he went to Razorfish, and Razorfish
went down.

Steve has sent several SQL examples, and there he almost always uses
the Query1.Close; Query1.Open; instead of using Query1.Active := False;
Query1.Active := True;

This is the closest matter that I was able to find:

Quote
> A TQuery with
> one of these SQL queries can be activated using the Open method or by
> setting the Active property to True -- but not with the ExecSQL method.
> A TQuery with an action SQL statement (such as with the INSERT, DELETE,
> DROP TABLE, or UPDATE commands) can _only_ be activated with the ExecSQL
> method. Trying to activate such a TQuery with the Open method or Active
> property will result in an error concerning not being able to create a
> cursor.

http://groups.google.com/groups?q=query+close+active+author:steve+aut...

and even this does not say, that in generel you better should use the
Dataset's Active property, than using Close/Open.

Markku Nevalainen

Re:BDE database problem.


I stuck the db component back in and it works fine. I guess i just wasnt
using the database component correctly, doh!

Thanks again.

James Smaldon

Quote
"Markku Nevalainen" <m...@iki.fi> wrote in message

news:3D542ECC.2247@iki.fi...
Quote
> James Smaldon wrote:

> > I found that if i removed the database component ("cddb_db")
> > from the application and set the databasename for each table and query
> > component rather than just for the database component

> That sounds a bit tedious way to do it, if you have a lot of
> tables. Better just drop the TDatabase component back, and
> modify your code slightly.
> There seems to be something to fix, though I earlier said the
> code looks OK.

> Instead of this:
>     dbpath := extractfilepath(database);
>     cddb_db.DatabaseName := dbpath;

> try something like this:
>     dbpath := extractfilepath(database);
>     cddb_db.Connected := False;
>     cddb_db.Params.Clear;
>     cddb_db.Params.Add('PATH=' +dbpath);
>     cddb_db.Connected := True;

> This is the way I have done it for years, easily point all the
> TTables and TQueries to new sub directories, by using one TDatabase
> as the connecting part.

> Markku Nevalainen

Re:BDE database problem.


On Sat, 10 Aug 2002 12:00:37 +0200, Markku Nevalainen <m...@iki.fi>
wrote:

Quote
>I also have read quite _some_ of Koterski's postings, but I don't
>remember seeing that kind of message. I wonder where is Koterski now
>a days. If I remember it right, he went to Razorfish, and Razorfish
>went down.

>Steve has sent several SQL examples, and there he almost always uses
>the Query1.Close; Query1.Open; instead of using Query1.Active := False;
>Query1.Active := True;

>This is the closest matter that I was able to find:
>> A TQuery with
>> one of these SQL queries can be activated using the Open method or by
>> setting the Active property to True -- but not with the ExecSQL method.
>> A TQuery with an action SQL statement (such as with the INSERT, DELETE,
>> DROP TABLE, or UPDATE commands) can _only_ be activated with the ExecSQL
>> method. Trying to activate such a TQuery with the Open method or Active
>> property will result in an error concerning not being able to create a
>> cursor.
>http://groups.google.com/groups?q=query+close+active+author:steve+aut...

>and even this does not say, that in generel you better should use the
>Dataset's Active property, than using Close/Open.

Hi Markku,
I am sorry if I gave the wrong advice.
I also cannot find it now.
Perhaps I was mistaken.
Best Regards
Johan Smit

Re:BDE database problem.


On Sat, 10 Aug 2002 12:00:37 +0200, Markku Nevalainen <m...@iki.fi>
wrote:

Quote
>I also have read quite _some_ of Koterski's postings, but I don't
>remember seeing that kind of message. I wonder where is Koterski now
>a days. If I remember it right, he went to Razorfish, and Razorfish
>went down.

>Steve has sent several SQL examples, and there he almost always uses
>the Query1.Close; Query1.Open; instead of using Query1.Active := False;
>Query1.Active := True;

>This is the closest matter that I was able to find:
>> A TQuery with
>> one of these SQL queries can be activated using the Open method or by
>> setting the Active property to True -- but not with the ExecSQL method.
>> A TQuery with an action SQL statement (such as with the INSERT, DELETE,
>> DROP TABLE, or UPDATE commands) can _only_ be activated with the ExecSQL
>> method. Trying to activate such a TQuery with the Open method or Active
>> property will result in an error concerning not being able to create a
>> cursor.
>http://groups.google.com/groups?q=query+close+active+author:steve+aut...

>and even this does not say, that in generel you better should use the
>Dataset's Active property, than using Close/Open.

Hi Markku,
I am sorry if I gave the wrong advice.
I also cannot find it now.
Perhaps I was mistaken.
Best Regards
Johan Smit

Other Threads