以下是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
新闻热点
疑难解答
图片精选