程序显示的结果不稳定,有时要按几次才能得到我要显示的内容
程序显示的结果不稳定,用的是asp调用vb dll,此结果是靠一个javascript触发打开新窗口,在里面每次根据不同的id显示不同情况的数据
有时要反复按几次才能出来正确,前几次出来的结果都是call aspexcel()的输出结果,而且每次生成的文件除了本生正常的文件名以外,还会多一个比这个名字多一秒的文件名,内容和此文件是相同的,(如有文件名http://localhost/a/csv/2007-03-14-09-44-19.xls和http://localhost/a/csv/2007-03-14-09-44-20.xls)程序如下
vb
Public str As String
Public Property Let strOutPath(s As Variant)
str = s
Call aspexcel( "select I_OBJECT from T_STOCK_TRACE_TR where 1=2 order by I_UPDATE_DATE desc ")
End Property
Public Property Get getOutPath()
getOutPath = str
End Property
Public Function aspexcel(ByVal SQLStr As String) As Boolean
Set cnn = New ADODB.Connection
cnn.Open = 略
Dim sfilename As String
sfilename = CStr(FormatDateTime(Now, 0))
sfilename = Replace(sfilename, " ", "- ")
str = sfilename
sfilename = App.Path & "\ " & sfilename & ".xls "
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Sheets(1)
略
cnn.Close
xlBook.SaveAs (sfilename)
Set xlSheet = Nothing
aspexcel = True
Exit Function
End Function
asp
<%set Myobj=server.CreateObject( "projectexcel.classexcel ")
Myobj.strOutPath=Server.Mappath( "csv ")
sfilename=Myobj.getOutPath
sfilename=sfilename& ".xls "
Myobj.aspexcel( "select语句 ")
set Myobj=nothing%>
<html>
<script>
window.location= "http://localhost/a/csv/ <%=sfilename%> ";
</script>
[解决办法]
不想给分就给0分
给1分是什么意思
鄙视