🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.database
Article #54

Re: creating alias at run time error 'unknown database alias: myRuntimeAlias'

#54
From: jo
Date: Fri, 18 Jun 2004 18:31
60 lines
3039 bytes
I have added a tdabase component and set it up with the same name as I was
using for an alias. Double clicked on it and setup as using default
settings. It has got past the alias not found error, but now i get:

file or directory does not exist
file:pdoxusers.net

I'm seem to be going round in circles, and they arnt decreasing! :(  Can
anyone point me in the right direction?

This is the code in my datamodule's oncreate event:

begin
session.PrivateDir:='C:\windows\temp';
//config file is written and created by install program
Ini := TIniFile.Create('cmsconfig.ini');
     try
     {get the dirs from the ini file}
     netdir:= Ini.ReadString('Dir', 'networkDir', '');
     sDataDir:=ini.readstring('Dir','databaseDir','');
     finally
     Ini.Free;
     end;

//sDataDir comes from ini file above
//modify the standard alias created by tdatabase so path is correct
database1.Params.Clear;
database1.Params.Add(sDataDir);

netdirmsg:='Cannot create ' +netdir;
//create dir for pdoxuser.lck files
if not DirectoryExists(netdir) then
    try CreateDir(netdir)
    except raise Exception.Create(netdirmsg);
    end;

// set the file path
session.NetFileDir:=netdir;
// now change registry so that local share is true
with tregistry.create do
        begin
        try
        RootKey:=HKEY_LOCAL_MACHINE;
        if not openKey('SOFTWARE\Borland\Database
Engine\Settings\SYSTEM\INIT',false) then
                raise Exception.createfmt('Error setting local share
true',['BDE']);
        writeString('LOCAL SHARE','TRUE');
        finally
                free;
        end;
        end;
//activate tables and queries at run time
query1.Active:=true;
query2.Active:=true;
tblCWmarks.Active:=true;
qryFBAll.Active:=true;
qryBriefCase.Active:=true;
qryTotals.Active:=true;
etc
Technical Details
Message-ID: <cavcet$3bj$1@hercules.btinternet.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!dedekind.zen.co.uk!zen.net.uk!demorgan.zen.co.uk!194.72.9.35.MISMATCH!news-peer1!btnet-feed5!btnet!news.btopenworld.com!not-for-mail
References: <cav4g0$et0$1@hercules.btinternet.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 115d96,718eba987327b4e6
X-Google-Thread: ffff5,718eba987327b4e6
X-Google-Attributes: gid115d96,gidffff5,public
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!dedekind.zen.co.uk!zen.net.uk!demorgan.zen.co.uk!194.72.9.35.MISMATCH!news-peer1!btnet-feed5!btnet!news.btopenworld.com!not-for-mail
From: "jo" <fitgirl99@btinternet.com>
Newsgroups: borland.public.delphi.database,comp.lang.pascal.delphi.databases
Subject: Re: creating alias at run time error 'unknown database alias: myRuntimeAlias'
Date: Fri, 18 Jun 2004 18:31:58 +0000 (UTC)
Organization: BT Openworld
Lines: 62
Message-ID: <cavcet$3bj$1@hercules.btinternet.com>
References: <cav4g0$et0$1@hercules.btinternet.com>
NNTP-Posting-Host: host213-122-26-157.in-addr.btopenworld.com
X-Trace: hercules.btinternet.com 1087583518 3443 213.122.26.157 (18 Jun 2004 18:31:58 GMT)
X-Complaints-To: news-complaints@lists.btinternet.com
NNTP-Posting-Date: Fri, 18 Jun 2004 18:31:58 +0000 (UTC)
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MSMail-Priority: Normal
X-Priority: 3
X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2600.0000