astro wrote:
I want to get the numeric named constant value from an ini file. Basically
I want to translate a string data type into the named constant value it
represents.
For example - for SQL-Server replication the sql_merge dll has the following
constants for configuring the security mode:
DB_AUTHENTICATION, NT_AUTHENTICATION
These values are 0, 1 respectively.
If I setup my ini file as follows:
PublisherSecurityMode = NT_AUTHENTICATION
and then attempt to set my SQL_Merge PublisherSecurityMode value to this - I
get a "wrong data type" error since it takes this value as a string and not
as a named constant.
I have tried eval(NT_AUTHENTICATION) which doesn't work.
I would rather avoid putting integers in my ini file. Is there a standard
way of dealing with this?
Thanks much.......
Your ini file should look like below. Your format of the ini file is not
a standard ini file format. A standard format is [Section] with
keywords= Value
after the section name.
[Section]
Keyword1 = Value1
Keyword2 = Value2
Look at any ini file in your windows directory.
[PublisherSecurityMode]
DB_AUTHENTICATION=0
NT_AUTHENTICATION=1
In my program I have a call of a function that return the data I want.
Dim cVersion As String
cVersion = Trim(GetINIFile(cPath, "Version", "ProgramVersion"))
cPath is the path to the ini file
Version is the section in the ini file
ProgramVersion is the Keyword in the Version section I want.
The call returns the value or a defaule value if ProgramVersion does not
exist.
Ron
--
Ronald W. Roberts
Roberts Communication
rw*@robcom.com