string str_savename,named,s_grxh
int excelok,li_net
long li_count,i
oleobject excelserver
excelserver=create oleobject
excelok=excelserver.connecttonewobject("excel.application")
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_1.settransobject(sqlca)
dw_1.reset()
excelserver.workbooks.open(str_savename)
excelserver.activesheet.cells.copy
li_count = dw_1.importclipboard(2)
clipboard("")
excelserver.quit()
excelserver.disconnectobject()
destroy excelserver
return 1
else
messagebox('ÐÅÏ¢Ìáʾ','ûÓÐÖ¸¶¨µ¼ÈëÎļþ!')
return -1
end if
运行后将数据可以成功导入
但保存时老提示primary key is not unique