Solved

BDE Filesharing

Posted on 1998-12-06
3
462 Views
Last Modified: 2013-11-23
I'm wanting to fileshare a database app (Paradox tables) on a LAN using standard BDE Aliases. The problem arises when I want to enable multiple accesses to the database. If I compile my app then I can run multiple copies on the local workstation with no problems, however, other users cannot connect. I fixed this by using Session.NetFileDir and Session.PrivateDir properties. This allows multiple users to access the table  ...  but now I can only run one instance of the app on each station. What do I need to do to allow multiple instances on multiple machines.

Thanx in advance

Darren
0
Comment
Question by:elkiors
  • 2
3 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 20 total points
ID: 1349567
hi elkiors,

each instance will use a own privatedir

a sample for a random privatedir


          unit Unit1;

          interface

          uses
            Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
            Grids, DBGrids, Db, DBTables, filectrl;

          type
            TForm1 = class(TForm)
              Table1: TTable;
              DataSource1: TDataSource;
              DBGrid1: TDBGrid;
              TestSession: TSession;
              procedure FormCreate(Sender: TObject);
              procedure FormClose(Sender: TObject; var Action: TCloseAction);
            private
              { Private-Deklarationen }
            public
              { Public-Deklarationen }
            end;

          var
            Form1: TForm1;

          implementation

          {$R *.DFM}

          function randomname : String;
          var
            i : Integer;
            s : String;
          begin
            s := '';
            for i := 1 to 8 do
              s := s + chr(Random(25)+ 65); {Only Letters from A to Z}
            randomname := s;
          end;



          procedure TForm1.FormCreate(Sender: TObject);
          var s : String;
          begin
            s := Randomname;
            while DirectoryExists('c:\'+s) do s := Randomname;
            if createdir('c:\'+s) then
            begin
              TestSession.PrivateDir := 'c:\'+s;
              TestSession.Active := True;
              { open Database Components }
              table1.open;
            end
            else
            begin
              { Problem occured }
            end;
          end;

          procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
          var
            Found : Integer;
            SRec : TSearchRec;
          begin
            TestSession.Active := False; {All DatabaseConnections will be closed }
            { Delete Files in temporary Directory }
            Found := FindFirst(TestSession.PrivateDir+'\*.*', faAnyFile, SRec);
            while Found = 0 do
            begin
              If SRec.Name[1] <> '.' then {Ignore Entries . and .. }
                Deletefile(TestSession.PrivateDir+'\'+SRec.Name);
              Found := FindNext(SRec);
            end;
            FindClose(SRec);
            rmdir(TestSession.PrivateDir);
          end;

          end.

Thats is a simple Example. Their are no Try-Except Blocks in it, so it can be that by the
Filehandling raised an Exception.

I hope you can use this tip

meikl
0
 

Author Comment

by:elkiors
ID: 1349568
Hi Meikl,

I haven't tested the code but I can see what you're getting at, I kind of stumbled across the multiple private dirs myself while I was at work today, although I had know idea on how to go about testing for the existing session, so that's a great help.

BTW Just got notification of you asking if anyone is around on Q10097306 Updating a Paradox Table - the one by RainbowSoftware.

I have a feeling that bird has flown, so I haven't bothered to respond again, otherwise we'll just keep triggering eachother to look at that page.

It's to be hoped that he hasn't just taken an answer and run. For me it's plain common courtesy that makes this site as enjoyable as it is. When other's take advantage or become abusive then it puts a downer on the whole shebang.

Anyway I've rambled along enough, sorry there wasn't anymore points available , I'm just about running on empty.

See you on another thread

Darren
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1349569
hi darren,

i will remember rainbowsoftware about Q10097306, if he/she/it place a new question here.
about the points, that doesn't matter, i am not here to get points en mas, its ok.

See you on another thread again

meikl


Q10097306
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question