标题: 帮帮忙吧,看看哪里出错了 [打印本页] 作者: 158403991 时间: 2009-12-29 17:52 标题: 帮帮忙吧,看看哪里出错了 Dim qtApp
Dim excelApp
Dim fos
Dim sheetNew
Dim workBook
folderpath=" E:\TestConnection"
filepath="E:\TestConnection\Conn.xls"
Set qtApp=createobject("QuickTest.Application")
qtApp.Visible=True
qtApp.Launch
Set excelApp=createobject("Excel.Application")
Set fos=createobject("Scripting.FileSystemObject")
If( fos.FolderExists (folderpath)) Then
reporter.ReportEvent micDone ,"the folder is exist","the folder is exist,please delete it"
fos.DeleteFolder folderpath
else
reporter.ReportEvent micDone,"the folder is not exist","the folder is not exist,please create it"
End If
set newfolder=fos.CreateFolder (folderpath)
If (fos.FileExists (filepath)) Then
reporter.ReportEvent micDone ,"the file is exist","the file is exist,please delete it"
fos.DeleteFile filepath
else
reporter.ReportEvent micDone,"the file is not exist","the file is not exist,please create it"
End If
set newfile=fos.CreateTextFile (filepath)
excelApp.Workbooks.Open filepath
excelApp.Workbooks.Add
Set newSheet = excelApp.Sheets.Item(1)
newSheet.Name = "age Information"
Set conn = CreateObject("adodb.connection")
set rs = createobject("adodb.recordset")
conn.open "rovider=SQLOLEDB.1assword=saersist Security Info=True;User ID=sa;Initial Catalog=mobile;Data Source=192.168.0.111"
sql="use qtp select * from TFQ_SYS_LOG"
rs.open sql,conn
Dim i
while not i ( rs.eof)
Log_ID = rs("LOGID").value
Log_TIME = rs("LOGTIME").value
Log_TEXT=rs("LOGTEXT").value
Log_ISSUCCESS=rs("ISSUCCESS").value
Log_ERROR=rs("LOGERROR").value
sheetNew.Cells(i+1,1).value = Log_ID
sheetNew.Cells(i+1,2).value =Log_TIME
sheetNew.Cells(i+1,3).value =Log_TEXT
sheetNew.Cells(i+1,4).value =Log_ISSUCCESS
sheetNew.Cells(i+1,5).value=Log_ERROR