Chinaunix首页 | 论坛 | 博客
  • 博客访问: 264812
  • 博文数量: 757
  • 博客积分: 40040
  • 博客等级: 大将
  • 技术积分: 4935
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-09 12:37
文章分类

全部博文(757)

文章存档

2011年(1)

2008年(756)

我的朋友

分类:

2008-09-09 12:44:34

 

        Dim TDConnection
        Set TDConnection = CreateObject("TDApiOle.TDConnection")

        TDConnection.InitConnection "" ' URL for the DB
        TDConnection.ConnectProject "TD76","bella","pino" ' Valid login information

        If TDConnection.Connected Then
          MsgBox("Connected to " + chr (13) + "Server " + TDConnection.ServerName _
          + chr (13) +"Project " + TDConnection.ProjectName )
        Else
          MsgBox("Not Connected")
        End If

        'Get the IBugFactory
        Set BugFactory = TDConnection.BugFactory

        'Add a new empty bug
        Set Bug = BugFactory.AddItem (Nothing)

        'fill the bug with relevant parameters
        Bug.Status = "New"
        Bug.Summary = "Connecting to TD"
        Bug.Priority = "4-Very High" ' depends on the DB
        Bug.AssignedTo = "admin" ' user that must exist in the DB's users list
        Bug.DetectedBy = "admin" ' user that must exist in the DB's users list

        'Post the bug to DB ( commit )
        Bug.Post


--------------------next---------------------
         ' Creates a specified file and returns a TextStream object that can be used to read from or write to the file.
        ' Example of usage
        ' Set f = CreateFile("d:\temp\beenhere.txt", True)
        ' f.WriteLine Now
        ' f.Close
        Function CreateFile(sFilename, bOverwrite)
            Set fso = CreateObject("scrīpting.FileSystemObject")
            Set CreateFile = fso.CreateTextFile(sFilename, bOverwrite)
        End Function

        ' Opens a specified file and returns a TextStream object that can be used to read from, write to, or append to the file.
        ' iomode: 1 - ForReading, 2 - ForWriting, 8 - ForAppending
        ' Example of usage
        ' Set f = OpenFile("d:\temp\beenhere.txt", 2, True)
        ' f.WriteLine Now
        ' f.Close

        Function OpenFile(sFilename, iomode, create)
            Set fso = CreateObject("scrīpting.FileSystemObject")
            Set ōpenFile = fso.OpenTextFile(sFilename, iomode, create)
        End Function

        ' Appends a line to a file
        ' Example of usage
        ' AppendToFile "d:\temp\beenhere.txt", Now
        Function AppendToFile(sFilename, sLine)
            Const ForAppending = 8
            If sFilename = "" Then
                sFilename = Environment("SystemTempDir") & "\QTDebug.txt"
            End If
            Set f = OpenFile(sFilename, ForAppending, True)
            f.WriteLine sLine
            f.Close
        End Function

        ' Writes a line to a file.
        ' Destroys the current content of the file!
        ' Example of usage
        ' WriteToFile "d:\temp\beenhere.txt", Now
        Function WriteToFile(sFilename, sLine)
            Const ForWriting = 2
            If sFilename = "" Then
                sFilename = Environment("SystemTempDir") & "\QTDebug.txt"
            End If
            Set f = OpenFile(sFilename, ForWriting, True)
            f.WriteLine sLine
            f.Close
        End Function


--------------------next---------------------

阅读(118) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~