string ls_pathname,ls_file,ls_ext
long ll_return
if dw_1.rowcount()<1 then
    messagebox('提示',"当前数据窗无记录数据,无导出的必要!",exclamation!)
    return
end if

ll_return=getfilesavename("导出文件",ls_pathname,ls_file,"txt","txt文件(*.txt),*.txt,csv文件(*.csv),*.csv,xls文件(*.xls),*.xls" )

if ll_return<>1 then return
IF fileexists(ls_pathname) THEN
    ll_return = messagebox('提示', ls_pathname+"已经存在,是否覆盖?",Question!, YesNo!)
    if ll_return=2 then return
end if

ls_ext = trim(right(ls_pathname,3))
if ls_ext = 'txt' then
    ll_return = dw_1.saveasascii(ls_pathname)
elseif ls_ext = 'csv' then
    ll_return = dw_1.saveasascii(ls_pathname)//,csv!,true)
elseif ls_ext = 'xls' then
    ll_return = dw_1.saveasascii(ls_pathname)//,Excel!,true)    
end if

IF ll_return <>1 then
    messagebox('错误',"导出数据失败!",stopsign!)
    return
END IF 
messagebox('提示',"已成功导出【"+string(dw_1.rowcount())+"】条数据;~r~n 文件位置"+ls_pathname)

 

posted on 2020-10-25 11:06  江湖小虾米L  阅读(651)  评论(0编辑  收藏  举报