以下是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("聯系人", objexcelsheet.cells(t, 12).value)
arrsql.add("錄入人", objexcelsheet.cells(t, 13).value)
arrsql.add("錄入日期", objexcelsheet.cells(t, 14).value)
arrsql.add("所屬分店", objexcelsheet.cells(t, 15).value)
'組合字段名
dim columnsql as string
'組合字段值
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
'組合sql語句
objcom.commandtext = "insert into content(" & columnsql & ")" & _
"values(" & valuesql & ")"
columnsql = ""
valuesql = ""
arrsql = nothing
新聞熱點
疑難解答
圖片精選