davoman
asked on
Always want the first entry of a hash table
Hi there
I am using a has table to store a field name in the key and a data type in the value
The first entry will be the Id I will be using for the table but the problem is when I want to pull this out I find it tricky
the below code brings out the first entry sorted on the key, rather than the first entry that was inserted
In a hastable is there a way to bring out the first entry inserted or should i do it another way
Dim myEnumerator As IDictionaryEnumerator = PropList.GetEnumerator()
TableID = ""
If TableID = "" Then
TableID = myEnumerator.Key
End If
While myEnumerator.MoveNext()
TableID = ""
If TableID = "" Then
TableID = myEnumerator.Key
End If
Select Case myEnumerator.Value.ToStrin g.ToUpper
Case "STRING"
objStartPt.Insert(vbCr + ControlChars.Tab + ControlChars.Tab + ".Add(""@" + myEnumerator.Key + """, SqlDbType.VarChar, (200)).Value = dbprep.PrepareSPROCStr(" + Classname + "." + myEnumerator.Key + ")")
Case "INTEGER"
objStartPt.Insert(vbCr + ControlChars.Tab + ControlChars.Tab + ".Add(""@" + myEnumerator.Key + """, SqlDbType.int).Value = " + Classname + "." + myEnumerator.Key)
Case "BOOLEAN"
objStartPt.Insert(vbCr + ControlChars.Tab + ControlChars.Tab + ".Add(""@" + myEnumerator.Key + """, SqlDbType.bit).Value = " + Classname + "." + myEnumerator.Key)
Case "DATE"
End Select
End While
Regards
steve
I am using a has table to store a field name in the key and a data type in the value
The first entry will be the Id I will be using for the table but the problem is when I want to pull this out I find it tricky
the below code brings out the first entry sorted on the key, rather than the first entry that was inserted
In a hastable is there a way to bring out the first entry inserted or should i do it another way
Dim myEnumerator As IDictionaryEnumerator = PropList.GetEnumerator()
TableID = ""
If TableID = "" Then
TableID = myEnumerator.Key
End If
While myEnumerator.MoveNext()
TableID = ""
If TableID = "" Then
TableID = myEnumerator.Key
End If
Select Case myEnumerator.Value.ToStrin
Case "STRING"
objStartPt.Insert(vbCr + ControlChars.Tab + ControlChars.Tab + ".Add(""@" + myEnumerator.Key + """, SqlDbType.VarChar, (200)).Value = dbprep.PrepareSPROCStr(" + Classname + "." + myEnumerator.Key + ")")
Case "INTEGER"
objStartPt.Insert(vbCr + ControlChars.Tab + ControlChars.Tab + ".Add(""@" + myEnumerator.Key + """, SqlDbType.int).Value = " + Classname + "." + myEnumerator.Key)
Case "BOOLEAN"
objStartPt.Insert(vbCr + ControlChars.Tab + ControlChars.Tab + ".Add(""@" + myEnumerator.Key + """, SqlDbType.bit).Value = " + Classname + "." + myEnumerator.Key)
Case "DATE"
End Select
End While
Regards
steve
Use IDictionary Interface
ASKER
that sounds good
how do i do that
how do i do that
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thats good enough for me
cheers for your help
cheers for your help