Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread "Cannot Perform this operation on a open database"
Wed, Jan 21 2015 11:48 AMPermanent Link

Paul L

Samu Games

Just repairing functions of old source code > Now that im using latest version of DBISAM ive encoutered a strange error

Heres the code

procedure TArtifactDataModule.SetupDatabase;
  var
     f1: boolean;
  begin
  ArtifactNoDatabase:=false;
  ArtifactPlayers:=TStringList.Create;
  try
     ArtifactDataDir:=ArtifactExeDir+ArtifactDataPath;
     CreateDir(ArtifactDataDir);
     ArtifactDatabase.Directory:=ArtifactDataDir;
    ArtifactDatabase.Connected:=true;
     // Make sure we have tables to work with
try
        OpenTables;
     except on EDatabaseError do
        try
           if ArtifactFirstTime then
              MakeAllTables
           else
              RepairTables;
           f1:=ArtifactFirstTime;
           OpenTables;
           ArtifactFirstTime:=f1;
        except on EDatabaseError do
           ArtifactNoDatabase:=true; // nothing
      end; // try
     end; // try

     if not ArtifactNoDatabase then
        begin
        LoadSystemData;
        FDatabaseSetup:=true;
           end;
  except on Exception do
     ArtifactDatabase.Connected:=false;
  end;
  end;


-----------------
Now the error im getting is "raised exception class EDatabaseError with message "Cannot Perform this operation on a open database".


Which point am i going wrong on? I cant see the versions changed so much from v3 too v4
Wed, Jan 21 2015 11:56 AMPermanent Link

Paul L

Samu Games

aHA I think i sorted it, I needed to put active to false then define everything,, facepalm anyone?
Image