. NET to build a arrdictionary

Source: Internet
Author: User
Tags integer tostring

The following are the Arrdictionary classes:
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 = "Error, no this!" "
End Try
End Function

Public Function Item (ByVal Key as String) as Object
Try
Item = Objcollection.item (Key)
Catch ex as Exception
Item = "Error, no this!" "
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


The following is the calling code snippet:
Dim Arrsql as New arrdictionary

Arrsql.add ("Receipt Number", Objexcelsheet.cells (t, 1). Value)
Arrsql.add ("House Address", Objexcelsheet.cells (T, 2). Value)
Arrsql.add ("Building Area", Objexcelsheet.cells (T, 3). Value)
Arrsql.add ("Room type", Objexcelsheet.cells (T, 4). Value)
Arrsql.add ("Orientation", Objexcelsheet.cells (T, 5). Value)
Arrsql.add ("Floors", objexcelsheet.cells (T, 6). Value)
Arrsql.add ("Production", Objexcelsheet.cells (T, 7). Value)
Arrsql.add ("Amount", Objexcelsheet.cells (T, 8). Value)
Arrsql.add ("area", Objexcelsheet.cells (T, 9). Value)
Arrsql.add ("Completion date", Objexcelsheet.cells (T, 10). Value)
Arrsql.add ("Service Life", Objexcelsheet.cells (t, 11). Value)
Arrsql.add ("Contacts", Objexcelsheet.cells (T, 12). Value)
Arrsql.add ("Input Person", objexcelsheet.cells (T, 13). Value)
Arrsql.add ("Entry Date", Objexcelsheet.cells (T, 14). Value)
Arrsql.add ("affiliated branch", Objexcelsheet.cells (T, 15). Value)

' Combine field names
Dim Columnsql as String
' Combine field values
Dim Valuesql as String

For I as Integer = 1 to Arrsql.i
Columnsql + = Arrsql.item (i). Key.tostring & ","
Valuesql + = "'" & Arrsql.item (i). Value.tostring & "',"
Next

' Combine SQL statements
Objcom.commandtext = "INSERT INTO Content" ("& Columnsql &") "& _
"Values (" & Valuesql & ")"

Columnsql = ""
Valuesql = ""
Arrsql = Nothing



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.