Article View: comp.lang.pascal.delphi.misc
Article #176Question about constants, variables and initialization
From: Sleiman
Date: Thu, 10 May 2001 09:11
Date: Thu, 10 May 2001 09:11
42 lines
2859 bytes
2859 bytes
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:
<3AFA5B33.78257C3D@hkisl.net>Path:
arc1-ca.pugleaf.net!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!194.25.134.62!newsfeed00.sul.t-online.de!t-online.de!skynet.be!news.netfront.net!newsgate.cuhk.edu.hk!cbpa01.nwcyberbase.com!A!news.att.net.hk!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fb362,baff753dcb973c5c,start X-Google-Attributes: gidfb362,public X-Google-Thread: 10baee,baff753dcb973c5c,start X-Google-Attributes: gid10baee,public X-Google-ArrivalTime: 2001-05-10 02:20:40 PST Path: arc1-ca.pugleaf.net!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!194.25.134.62!newsfeed00.sul.t-online.de!t-online.de!skynet.be!news.netfront.net!newsgate.cuhk.edu.hk!cbpa01.nwcyberbase.com!A!news.att.net.hk!not-for-mail From: Sleiman <sleiman@hkisl.net> Newsgroups: comp.lang.pascal.delphi.misc,borland.public.delphi.internet Subject: Question about constants, variables and initialization Date: Thu, 10 May 2001 17:11:15 +0800 Organization: AT&T EasyLink Services Asia-Pacific Lines: 44 Message-ID: <3AFA5B33.78257C3D@hkisl.net> NNTP-Posting-Host: ppp9-126.iawhk.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.75 [en] (Win95; U) X-Accept-Language: en