日期:2013-08-31  浏览次数:20531 次

以下是ArrDictionary类:
Public Class ArrDictionary
    Private objCollection As New Collection
    Private objDic As New DictionaryEntry
    Private strKey, strValue As String
    Public i As Integer

    Public Function Item(ByVal Index As Integer) As Object
        Try
            Item = objCollection.Item(Index)
        Catch ex As Exception
            Item = "错误,无此项!"
        End Try
    End Function

    Public Function Item(ByVal Key As String) As Object
        Try
            Item = objCollection.Item(Key)
        Catch ex As Exception
            Item = "错误,无此项!"
        End Try
    End Function

    Public Sub Add(ByVal Key As String, ByVal Value As String)
        objDic.Key = Key
        objDic.Value = Value
        objCollection.Add(objDic, objDic.Key)
        i += 1
    End Sub

    Protected Overrides Sub Finalize()
        MyBase.Finalize()
        objCollection = Nothing
        objDic = Nothing
        strKey = ""
        strValue = ""
        i = 0
    End Sub
End Class


以下是调用代码段:
                Dim arrSQL As New ArrDictionary

                arrSQL.Add("收件号", objExcelSheet.Cells(t, 1).Value)
                arrSQL.Add("房屋地址", objExcelSheet.Cells(t, 2).Value)
                arrSQL.Add("建筑面积", objExcelSheet.Cells(t, 3).Value)
                arrSQL.Add("房型", objExcelSheet.Cells(t, 4).Value)
                arrSQL.Add("朝向", objExcelSheet.Cells(t, 5).Value)
                arrSQL.Add("楼层", objExcelSheet.Cells(t, 6).Value)
                arrSQL.Add("产别", objExcelSheet.Cells(t, 7).Value)
                arrSQL.Add("金额", objExcelSheet.Cells(t, 8).Value)
                arrSQL.Add("区域", objExcelSheet.Cells(t, 9).Value)
                arrSQL.Add("竣工日期", objExcelSheet.Cells(t, 10).Value)
                arrSQL.Add("使用年限", objExcelSheet.Cells(t, 11).Value)
                arrSQL.Add("联系人", objExcelS