dポイントプレゼントキャンペーン実施中!

ASPは全くの初心者です。
今回、二次元のDictionaryを使って値を表示させたいのですが
行き詰ってしまいました。
以下のコードをどのように変換すれば良いですか?



<%@ LANGUAGE = VBSCRIPT %>
<%
call dictionary_create()

Sub dictionary_create()

Dim objParent
Dim objChild
dim x

Set objParent = CreateObject("Scripting.Dictionary")
For x=0 to 9
Set objChild = CreateObject("Scripting.Dictionary")

objChild.Add "kaigi", "会議名"&i
objChild.Add "Id", "0"&i
objParent.Add x, objChild

Set objChild = Nothing

Response.Write objParent.Item("ConfName")

Next
end sub
%>

A 回答 (1件)

だいぶソースコードを間違えている?感じだったのと、


元々、どういう仕様で二次元配列にデータを格納させたいのか
言わないと質問しても正しい回答を頂けませんよ。

さて、そんな何がしたいのかわからない中、半分私の憶測でやってみました。きっとこんなことがしたいんですよね?

<%@ LANGUAGE = VBSCRIPT %>
<%
call dictionary_create()

Sub dictionary_create()

Dim objParent
Dim objChild

Dim objCurrentParent

dim x


Set objParent = CreateObject("Scripting.Dictionary")

For x = 0 To 9
  Set objChild = CreateObject("Scripting.Dictionary")

  objChild.Add "kaigi", "会議名"& x
  objChild.Add "Id", "0" & x
  objParent.Add x, objChild

  Set objChild = Nothing

''' そうじゃない!
'''Response.Write objParent.Item("ConfName")

  Set objCurrentParent = objParent.Item(x)
  Response.Write objCurrentParent.Item("kaigi") & "<br />"
  Response.Write objCurrentParent.Item("Id") & "<br />"
  Set objCurrentParent = Nothing

Next
end sub
%>

■実行結果
会議名0
00
会議名1
01
会議名2
02
会議名3
03
会議名4
04
会議名5
05
会議名6
06
会議名7
07
会議名8
08
会議名9
09

ご参考になれば幸いです。
    • good
    • 0
この回答へのお礼

ご丁寧な説明ありがとうございました。
次回からはしっかり要件を伝えるよう心がけます。

お礼日時:2008/11/14 00:13

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!