Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

ASP CompareMode Property

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

The ASP CompareMode Property is used to return and set the data comparison mode which compares the keys in a Dictionary Object. The data comparison mode can have the following value.

  • vbBinaryCompare (0): This specifies that binary comparison will be used for the data.
  • vbTextCompare (1): This specifies that textual comparison will be used for the data.
  • vbDatabaseCompare (2): This specifies that database comparison will be used for the data.

Syntax:

DictionaryObject.CompareMode[=compare]

Parameter: This property has a single parameter as mentioned above and described below:

  • compare: It is used to specify the comparison mode in the Dictionary Object. It is an optional parameter.

The below example demonstrates the ASP Dictionary.CompareMode Property.

Example:

ASP




<%
dim dic
  
'Create a dictionary object
set dic=Server.CreateObject("Scripting.Dictionary")
  
'Set the comparison mode to be used
dic.CompareMode=1
  
'Add some key-value pairs to the dictionary
dic.Add "s","sudo"
dic.Add "c","competitive"
  
'Trying to add a new key that does not exists
dic.Add "p","placements"
  
Response.Write("The 'p' key-value was successfully added!")
  
'Trying to add a new key that already exists
'This will fail as the already exists!
dic.Add "c","code"
  
Response.Write("The 'c' key-value was successfully added!")
%>

Output:

The 'p' key-value was successfully added!
An error occurred on the server when processing the URL.
My Personal Notes arrow_drop_up
Last Updated : 22 Mar, 2021
Like Article
Save Article
Similar Reads
Related Tutorials