Tom Knowlton
asked on
Add HashTable as Value inside another Hashtable
How can I reuse htFields inside the For Each loop?
I want to add htFields as the value for the matching key inside htTables
dim htTables as New Hashtable()
for each str as String in GetTableNames(conn)
debug.WriteLine(str)
htTables.Add(str,Nothing)
conn.Open
Dim cmd1 As OleDb.OleDbCommand = New OleDb.OleDbCommand("select * from " & str, conn)
Dim dra As IDataReader = cmd1.ExecuteReader(Command Behavior.S chemaOnly Or CommandBehavior.KeyInfo)
Dim dta As DataTable = dra.GetSchemaTable()
Dim myrow As DataRow
For Each myrow In dta.Rows
Debug.WriteLine("Column Name: " + myrow(0).ToString)
dim htFields As New Hashtable()
htFields.Add(myrow(0).ToSt ring(),fal se)
Next
htTables(str) = htFields
htFields = Nothing
dra.Close
conn.Close
Next
I want to add htFields as the value for the matching key inside htTables
dim htTables as New Hashtable()
for each str as String in GetTableNames(conn)
debug.WriteLine(str)
htTables.Add(str,Nothing)
conn.Open
Dim cmd1 As OleDb.OleDbCommand = New OleDb.OleDbCommand("select
Dim dra As IDataReader = cmd1.ExecuteReader(Command
Dim dta As DataTable = dra.GetSchemaTable()
Dim myrow As DataRow
For Each myrow In dta.Rows
Debug.WriteLine("Column Name: " + myrow(0).ToString)
dim htFields As New Hashtable()
htFields.Add(myrow(0).ToSt
Next
htTables(str) = htFields
htFields = Nothing
dra.Close
conn.Close
Next
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER