Forum Discussion
AlexKaras
14 years agoChampion Level 3
Hi Mruttunjay,
The problem is in the
While Not RecSet.EOF
for iIndex = 0 to Driver.ColumnCount-1
objDict.Add (Driver.ColumnName(iIndex)), RecSet.Fields(Driver.ColumnName(iIndex)).Value
Next
RecSet.MoveNext
WEnd
code snippet.
What it does is creation of the 'column name - column value' pairs.
I.e. for the Table1 the dictionary structure will be like this:
Key Value
---- -----
TCID TC1
EmpName David
which is fine.
Hovewer, for the Table2 the dictionary structure will be like this:
Key Value
---- -----
TCID TC1
EmpName David
TCID TC2
EmpName Adam
which is incorrect because duplication of the key values is not allowed for the dictionary.
Maybe, instead of the mentioned code snippet you need just this one:
While Not RecSet.EOF
objDict.Add RecSet.Fields(Driver.ColumnName(0)).Value, RecSet.Fields(Driver.ColumnName(1)).Value
RecSet.MoveNext
WEnd
with the
Log.message (dictObj.item("EmpName"))
line in Test2 replaced with
Log.message (dictObj.item("TC2"))
?
The problem is in the
While Not RecSet.EOF
for iIndex = 0 to Driver.ColumnCount-1
objDict.Add (Driver.ColumnName(iIndex)), RecSet.Fields(Driver.ColumnName(iIndex)).Value
Next
RecSet.MoveNext
WEnd
code snippet.
What it does is creation of the 'column name - column value' pairs.
I.e. for the Table1 the dictionary structure will be like this:
Key Value
---- -----
TCID TC1
EmpName David
which is fine.
Hovewer, for the Table2 the dictionary structure will be like this:
Key Value
---- -----
TCID TC1
EmpName David
TCID TC2
EmpName Adam
which is incorrect because duplication of the key values is not allowed for the dictionary.
Maybe, instead of the mentioned code snippet you need just this one:
While Not RecSet.EOF
objDict.Add RecSet.Fields(Driver.ColumnName(0)).Value, RecSet.Fields(Driver.ColumnName(1)).Value
RecSet.MoveNext
WEnd
with the
Log.message (dictObj.item("EmpName"))
line in Test2 replaced with
Log.message (dictObj.item("TC2"))
?