打开上船的excel文件
set objExcelApp = CreateObject("Excel.Application")
objExcelApp.DisplayAlerts = false
objExcelApp.Application.Visible = false
objExcelApp.Workbooks.Open(xlspath) '打开Excel模板
set objExcelBook = objExcelApp.ActiveWorkBook
set objExcelSheets = objExcelBook.Worksheets
set objExcelSheet = objExcelBook.Sheets(1)
'打开access数据库
set userconn = server.createobject("ADODB.Connection")
path=server.mappath("database")+"\G10process.mdb"' 获得数据库的相对路径
userconn.ConnectionString = "DBQ="+path+";DRIVER={Microsoft Access Driver (*.mdb)};"
userconn.open
以下是数据库更新的操作函数:
sub updatetable(object, conn, hang)'输入参数:excel数据集,access数据库连接, 行号
dim updatesql, i
updatesql = "update processtable set " &object.cells(1,2)&" = '" & object.cells(hang,2)& "'"
i = 3
do while not object.cells(1,i) = ""
if (not trim(object.cells(hang,i)) = "") and (not trim(object.cells(hang,i)) = "-") and (not trim(object.cells(hang,i)) = "-") then
updatesql = updatesql & " , " &object.cells(1,i)&" = '" & object.cells(hang,i) & "'"
' else updatesql = updatesql & " = ''"
end if
i = i+1
loop
updatesql = updatesql & " where 站号 = '" &object.cells(hang,1)& "'"
conn.execute(updatesql)
end sub
请各路高手不吝赐教。
2 个解决方案
#1
有人能帮忙吗?这问题挺严重的,快来帮帮我,只要有效马上给分。
#2
自己的服务器?装个2003系统
#1
有人能帮忙吗?这问题挺严重的,快来帮帮我,只要有效马上给分。
#2
自己的服务器?装个2003系统