Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Associative/Hash Array within ASP

Status
Not open for further replies.

vcherubini

Programmer
May 29, 2000
527
US
Hello:

I was wondering if ASP supports associative arrays (also known as hash arrays or name/value pair arrays)? An example in PHP would be:
[tt]
$array['name'] = "value";
[/tt]

However, if I try:
[tt]
dim my_array(1)
my_array("name") = "value"
[/tt]

I get a parse error. Is there a way to overcome this? Having your arrays look like function calls seems pretty unintuitive, if you ask me.

If anyone can help, I would appreciate it very much.

Thanks,
-Vic vic cherubini
krs-one@cnunited.com
 
From my MSDN Library:

A Dictionary object is the equivalent of a PERL associative array. Items, which can be any form of data, are stored in the array. Each item is associated with a unique key. The key is used to retrieve an individual item and is usually a integer or a string, but can be anything except an array.

The following code illustrates how to create a Dictionary object:

Dim d ' Create a variable.
Set d = CreateObject("Scripting.Dictionary")
d.Add "a", "Athens" ' Add some keys and items.
d.Add "b", "Belgrade"
d.Add "c", "Cairo"
...
To err is human, but to really foul things up requires a computer.
- Farmers' Almanac, 1978

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top