Skip to content
Related Articles

Related Articles

ASP Add Method

View Discussion
Improve Article
Save Article
  • Last Updated : 22 Mar, 2021
View Discussion
Improve Article
Save Article

The ASP Dictionary.Add Method is used to add a new key-value pair to the Dictionary Object.


DictionaryObject.Add(key, item)

Parameters: This method has two parameters as mentioned above and described below:

  • key: It specifies the name of the key to be inserted. It is a required parameter.
  • item: It specifies the value that has to be associated with the key in the key-value pair.

Example: The below code demonstrates the ASP Dictionary.Add Method.


Dim dict
'Create a new dictionary
Set dict=Server.CreateObject("Scripting.Dictionary")
'Add values to the dictionary
dict.Add "w","white"
dict.Add "b","blue"
dict.Add "br","Brown"
dict.Add "p","Pink"
'Retrieve some values from the dictionary
Response.Write("Value of key 'br' is: " & dict.Item("br"))
Response.Write("<br>Value of key 'p' is: " & dict.Item("p"))


Value of key 'br' is: Brown
Value of key 'p' is: Pink
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!