Board index » delphi » Master-Detail TSession TQuery Error

Master-Detail TSession TQuery Error

All;

    I need some help with the Directory is controlled by other .NET file
error in a Master-Detail relationship.

    When I open the Master TQuery it works fine.  When I open the Detail
TQuery after that, I get the above error.

    I set the TSession.NetFileDir and the TSession.PrivateDir to two
separate location on my HD.  I open the TDataBase and the TSession with no
problems.

    What's going on with the Detail Query?  It should work, the SessionName
is set to the same TSession as the Master Query and the DataSource is set to
the Master Query.  If I blank the TSession.NetFileDir and the
TSession.PrivateDir properties the Queries work.

    I have removed all *.LCK and *.NET files with no luck in making this
work.  Like I said above, if I blank out the TSession properties for
NetFileDir and PrivateDir, the TQueries will open up otherwise I get the
Directory is controlled by other .NET file error on the Detail TQuery.
This is weird!  I get this on NT and Win2000.

    The app is not networked, I'm using D5 w/all patches and the BDE with
all patches(5.1.1).

    Any help would be appreciated.

Dean Jones

 

Re:Master-Detail TSession TQuery Error


Session.PrivateDir should point to a temporary directory on a local drive.
Session.NetFileDir should point to a directory that is accessable for all
applications using the database (for file-based databases the database
directory works best).

So, if you are using a single TDatabase component for a file-based database
you can use:

var
  Buffer: array[0..MAX_PATH - 1] of Char;
  TempPath: String;
begin
  SetString(TempPath, Buffer, Windows.GetTempPath(Buffer, SizeOf(Buffer)));
  Session.PrivateDir := TempPath;
  Session.NetFileDir := ExtractFilePath(Database.Values['DATABASE NAME']);
end;

"Dean Jones" <ptsoftw...@home.com> schreef in bericht
news:srXt6.51798$o7.2300941@news1.rdc1.sdca.home.com...

Quote
> All;

>     I need some help with the Directory is controlled by other .NET file
> error in a Master-Detail relationship.

>     When I open the Master TQuery it works fine.  When I open the Detail
> TQuery after that, I get the above error.

>     I set the TSession.NetFileDir and the TSession.PrivateDir to two
> separate location on my HD.  I open the TDataBase and the TSession with no
> problems.

>     What's going on with the Detail Query?  It should work, the
SessionName
> is set to the same TSession as the Master Query and the DataSource is set
to
> the Master Query.  If I blank the TSession.NetFileDir and the
> TSession.PrivateDir properties the Queries work.

>     I have removed all *.LCK and *.NET files with no luck in making this
> work.  Like I said above, if I blank out the TSession properties for
> NetFileDir and PrivateDir, the TQueries will open up otherwise I get the
> Directory is controlled by other .NET file error on the Detail TQuery.
> This is weird!  I get this on NT and Win2000.

>     The app is not networked, I'm using D5 w/all patches and the BDE with
> all patches(5.1.1).

>     Any help would be appreciated.

> Dean Jones

Other Threads