🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.delphi.misc
Article #177

Re: Question about constants, variables and initialization

#177
From: M.H. Avegaart
Date: Tue, 08 May 2001 11:58
49 lines
3234 bytes
Use a TDatabase component and add the code to the BeforeConnect event.


"Sleiman" <sleiman@hkisl.net> schreef in bericht
news:3AFA5B33.78257C3D@hkisl.net...
> Hello
>
> So far I had the name of the database hard-coded into my cgi script
> code, as in
>         const myDBname = 'isl';
> in a unit called Common that is used in all other units. Currently I am
> working on making the cgi script take that value from an INI file, but I
> am having difficulty in positioning the code that does that. I mean,
> where shall I call the subroutine that reads the INI file? I tried the
> following and none of it works:
> 1) In the Initialization part of the unit Common.
> 2) In the TWM.WMCreate subroutine.
> 3) I even tried to have myDBname as a global variable and hard-code
>         myDBName:='isl';
> into the Initialization part of Common.
>
> In all the above cases the cgi script produces a message such as:
> >Open table Quote: Quote_no-Data base server error.
> >Table does not exist. File or directory does not exist.
> >File: d:\sol\gwdb2\isapi\Quote.DB
> (this happens when wanting to open the Quote table of the isl database)
>
> It seems to me that the task is rather simple, but I have to initialise
> the database name in the right place. A couple more things I'd like to
> mention:
> I. In TWM.WMCreate subroutine, I need the myDBName value, since there is
> the statement:
>     Database.DatabaseName := myDBName;
> So wherever myDBName is initialized it has to be before that statement
> (in the TWM.WMCreate subroutine or in a different subroutine that is
> executed before it).
> That statement can also move to some other place, if its location is not
> appropriate.
> II. I want to be able to terminate the application with an appropriate
> error message if reading from the INI file failed. I thought I'd  check
> this in the TWM.WebModuleBeforeDispatch subroutine (if reading the INI
> file failed, a global variable ReadINIerrorMsg becomes non-blank).
>
> Do you have any idea/tip about this?
>
> Many thanks for your attention
> Sleiman
>
>
Technical Details
Message-ID: <9ddvd5$156b$1@scavenger.euro.net>
Path: arc1-ca.pugleaf.net!newsfeed.google.com!newsfeed.stanford.edu!skynet.be!newsfeeds.belnet.be!news.belnet.be!news2.euro.net!news.euronet.nl!not-for-mail
References: <3AFA5B33.78257C3D@hkisl.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10baee,baff753dcb973c5c
X-Google-Attributes: gid10baee,public
X-Google-Thread: fb362,baff753dcb973c5c
X-Google-Attributes: gidfb362,public
X-Google-ArrivalTime: 2001-05-10 04:52:02 PST
Path: arc1-ca.pugleaf.net!newsfeed.google.com!newsfeed.stanford.edu!skynet.be!newsfeeds.belnet.be!news.belnet.be!news2.euro.net!news.euronet.nl!not-for-mail
From: "M.H. Avegaart" <avegaart@NOSPAMmccomm.nl>
Newsgroups: comp.lang.pascal.delphi.misc,borland.public.delphi.internet
Subject: Re: Question about constants, variables and initialization
Date: Tue, 8 May 2001 13:58:32 +0200
Organization: Wanadoo NL
Lines: 51
Message-ID: <9ddvd5$156b$1@scavenger.euro.net>
References: <3AFA5B33.78257C3D@hkisl.net>
NNTP-Posting-Host: p1277.vcu.wanadoo.nl
X-Trace: scavenger.euro.net 989495526 38091 194.134.170.2 (10 May 2001 11:52:06 GMT)
X-Complaints-To: abuse@wanadoo.nl
NNTP-Posting-Date: Thu, 10 May 2001 11:52:06 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600