Thread View: comp.lang.pascal.delphi.misc
2 messages
2 total messages
Started by Sleiman
Thu, 10 May 2001 09:11
Question about constants, variables and initialization
Author: 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
Re: Question about constants, variables and initialization
Author: M.H. Avegaart
Date: Tue, 08 May 2001 11:58
Date: Tue, 08 May 2001 11:58
49 lines
3234 bytes
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 > >
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads