 |
|
|
 |
|
Copies a string into the specified section of the specified initialization file.
|
 |
|
Return Value: Nonzero if successful; otherwise 0.
|
 |
|
Syntax: object.WriteString(strApp, strKey, strVal, strFile)
|
 |
|
Example:
The following example creates new entree "LastName" in the file "d:\temp\userinf.ini"
under Section "UserInformation" equals to "Ivanov":
|
- <%
- Set MyObj=Server.CreateObject("MagicBundle.MagicINI")
lpappname = "UserInformation"
lpkeyname = "LastName"
lpfilename = "d:\temp\userinf.ini"
if myobj.WriteString(lpappname, lpkeyname, "Ivanov",
lpfilename) then
response.write "Value is written
successfully"
else
response.write("Error #" & MyObj.GetLastErrorNbr & " occurred:")
response.write(MyObj.GetLastErrorDscr)
end if
- %>
Note: If file or section name does not exist function WriteString
will create for you automatically.
|
 |
|
|
 |
|
Retrieves a string from the specified section in an initialization file.
|
 |
|
Return Value: key value if successful; otherwise empty string.
|
 |
|
Syntax: object.ReadString(strApp, strKey, strFile)
|
 |
|
Example:
This example returns value of the "LastName" key under
"UserInformation" section.
|
- <%
-
Set MyObj=Server.CreateObject("MagicBundle.MagicINI")
lpappname = "UserInformation"
lpkeyname = "LastName"
lpfilename = "d:\temp\userinf.ini"
mystr = myobj.ReadString(lpappname, lpkeyname, lpfilename)
if mystr<>"" then
response.write "Last Name is " & mystr
else
response.write("Error #" & MyObj.GetLastErrorNbr & " occurred:")
response.write(MyObj.GetLastErrorDscr)
end if
- %>
|
 |
|
|
 |
|
Deletes all contexts of the section.
|
 |
|
Return Value: Nonzero if successful; otherwise 0.
|
 |
|
Syntax: object.DeleteSection(strApp, strFile)
|
 |
|
Example:
This example deletes "UserInformation" section from file "d:\temp\userinf.ini"
- <%
-
Set MyObj=Server.CreateObject("MagicBundle.MagicINI")
lpappname = "UserInformation"
lpfilename = "d:\temp\userinf.ini"
if myobj.DeleteSection(lpappname, lpfilename) then
response.write "Deleted successfully"
else
response.write("Error #" & MyObj.GetLastErrorNbr & " occurred:")
response.write(MyObj.GetLastErrorDscr)
end if
- %>
|
 |
|
|
 |
|
Deletes string contexts of the section.
|
 |
|
Return Value: Nonzero if successful; otherwise 0.
|
 |
|
Syntax: object.DeleteString(strApp, strKey, strFile)
|
 |
|
Example:
This example deletes key and associated value
in "LastName".
|
- <%
-
Set MyObj=Server.CreateObject("MagicBundle.MagicINI")
lpappname = "UserInformation"
lpkeyname = "LastName"
lpfilename = "d:\temp\userinf.ini"
if myobj.DeleteString(lpappname, lpkeyname, lpfilename) then
response.write "Value is deleted
successfully."
else
response.write("Error #" & MyObj.GetLastErrorNbr & " occurred:")
response.write(MyObj.GetLastErrorDscr)
end if
- %>
|
 |
|
|
 |
|
Search a key in the specified section in an initialization file.
|
 |
|
Return Value: Nonzero if successful; otherwise 0.
|
 |
|
Syntax: object.CheckKey(strApp, strKey, strFile)
|
 |
|
Example:
This example searches the key "LastName" in the "UserInformation" section in the file "d:\temp\userinf.ini"
- <%
-
Set MyObj=Server.CreateObject("MagicBundle.MagicINI")
lpappname = "UserInformation"
lpkeyname = "LastName"
lpfilename = "d:\temp\userinf.ini"
if myobj.CheckKey(lpappname, lpkeyname, lpfilename) then
response.write "Key exists."
else
response.write(MyObj.GetLastErrorDscr)
end if
- %>
|
 |
|
|
 |
|
Syntax: object.GetLastErrorNbr
|
 |
|
Returns number of the last error.
|
 |
|
|
 |
|
Syntax: object.GetLastErrorDscr
|
 |
|
Returns description of the last error.
|