您的位置:程序门 -> vb -> 基础类



欢迎大家动脑讨论,asp调用vb dll后,输出的只是e:\addf\csv,而我想输出e:\addf\csv\2007-3-9-上午-11-36-51.xls,具体vb和asp程序如下


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


欢迎大家动脑讨论,asp调用vb dll后,输出的只是e:\addf\csv,而我想输出e:\addf\csv\2007-3-9-上午-11-36-51.xls,具体vb和asp程序如下[已结贴,结贴人:renjun24]
发表于:2007-03-09 13:38:56 楼主
欢迎大家动脑讨论,asp调用vb   dll后,输出的只是e:\addf\csv,而我想输出e:\addf\csv\2007-3-9-上午-11-36-51.xls,具体vb和asp程序如下
public   str   as   string
public   property   let   stroutpath(s   as   variant)
        str   =   s
        end   property

public   property   get   getoutpath()
  getoutpath   =   str
end   property
public   function   aspexcel(byval   sqlstr   as   string)   as   boolean

    dim   sfilename   as   string
    sfilename   =   cstr(formatdatetime(now,   0))
        sfilename   =   format(cdate(sfilename),   "yyyy-m-d-ampm-hh:mm:ss ")
        sfilename   =   replace(sfilename,   "am ",   "上午 ")
        sfilename   =   replace(sfilename,   "pm ",   "下午 ")
          sfilename   =   replace(sfilename,   ": ",   "- ")     ' '
      str   =   sfilename
    sfilename   =   app.path   &   "\ "   &   sfilename   &   ".xls "
        aspexcel   =   true
        exit   function
end   function
<%
set   myobj=server.createobject( "projectexcel.classexcel ")    
myobj.stroutpath=server.mappath( "csv ")
response.write   myobj.getoutpath
%>
发表于:2007-03-09 13:48:271楼 得分:0
友情帮顶
发表于:2007-03-09 13:59:342楼 得分:0
哈哈,谢谢
发表于:2007-03-09 14:03:593楼 得分:1
public   str   as   string

public   property   let   stroutpath(s   as   variant)
        str   =   s
        call   aspexcel( " ")     ' ' ' ' ' ' ' ' ' ' ' '根据你的调用的情况,要执行一下,才能正确。
end   property

public   property   get   getoutpath()
  getoutpath   =   str
end   property
发表于:2007-03-09 14:43:474楼 得分:0
你介绍的办法很好,试了,是正确的,但是问题又来了,call   aspexcel里面的东西不能随便写的,因为里面的参数是以后在asp里要用到的关于根据不同情况执行不同的sql语句的,我在vb里只好先写上这样的参数( "select   i_object   from   t_stock   where   1=2   order   by   i_update_date   desc "),这还不是最大的问题,最大的问题是在asp里,最后输出.xls文件时说http   404找不到http://localhost/asdf/2007-3-8-下午-03-27-40.xls,asp全部语句见下
set   myobj=server.createobject( "projectexcel.classexcel ")    
myobj.stroutpath=server.mappath( "csv ")
sfilename=myobj.getoutpath
sfilename=sfilename& ".xls "
myobj.aspexcel( "select   i_object   from   t_stock   where   i_game_cd= ' "   &   trim(request.querystring( "id "))   &   " '   order   by   i_update_date   desc ")
  set   myobj=nothing
%>
<html>
    <script>
    window.location= " <%=sfilename%> ";
</script>


快速检索

最新资讯
热门点击