string str_savename,named,s_grxh
int excelok,li_net
long li_count,i
oleobject excelserver
excelserver=create oleobject
excelok=excelserver.connecttonewobject("excel.application")
//检查返回值,以确保已成功地连接到了Excel
if excelok <> 0 then
messagebox("信息提示","连接EXCEL失败,请检查计算机中是否安装了EXCEL!")
return -1
end if
li_net = GetFileOpenName("选择文件", str_savename,named,"xls","Excel文件(*.xls),*.xls")
if li_net > 0 then
if str_savename = "" then return -1
dw.settransobject(sqlca)
dw.reset()
excelserver.workbooks.open(str_savename)
excelserver.activesheet.cells.copy
li_count = dw.importclipboard(2) //导入数据
clipboard("")
excelserver.quit()
excelserver.disconnectobject()
destroy excelserver
return 1
else
messagebox('信息提示','没有指定导入文件!')
return -1
end if
int excelok,li_net
long li_count,i
oleobject excelserver
excelserver=create oleobject
excelok=excelserver.connecttonewobject("excel.application")
//检查返回值,以确保已成功地连接到了Excel
if excelok <> 0 then
messagebox("信息提示","连接EXCEL失败,请检查计算机中是否安装了EXCEL!")
return -1
end if
li_net = GetFileOpenName("选择文件", str_savename,named,"xls","Excel文件(*.xls),*.xls")
if li_net > 0 then
if str_savename = "" then return -1
dw.settransobject(sqlca)
dw.reset()
excelserver.workbooks.open(str_savename)
excelserver.activesheet.cells.copy
li_count = dw.importclipboard(2) //导入数据
clipboard("")
excelserver.quit()
excelserver.disconnectobject()
destroy excelserver
return 1
else
messagebox('信息提示','没有指定导入文件!')
return -1
end if