软件测试开发技术SQL Server数据库对象信息的获取[3]

发表于:2009-10-14来源:作者:点击数: 标签:软件测试数据库SQLsqlSql
软件测试 开发 技术 SQL Server 数据库 对象信息的获取[3] SQL Server数据库 关键字: sql Dim oDB As SQLDMO.Database Set oDB = o SQLServer .Databases(cob_sqldb.List(cob_sqldb.ListIndex)) If oCurrentDB Is Nothing Then Set oCurrentDB = oDB Else I

软件测试开发技术SQL Server数据库对象信息的获取[3]  SQL Server数据库

关键字:sql         Dim oDB As SQLDMO.Database

        Set oDB = oSQLServer.Databases(cob_sqldb.List(cob_sqldb.ListIndex))

        If oCurrentDB Is Nothing Then

            Set oCurrentDB = oDB

        Else

            If oCurrentDB.Name = oDB.Name Then

            Exit Sub

        End If

        Set oCurrentDB = Nothing

        Set oCurrentDB = oDB

    End If

    FillEmptyTableList (True)

    If cob_sqltable.ListCount > 0 Then

        cob_sqltable.ListIndex = 0

        cob_sqltable_Click

    End If

    ......

    End Sub

    Private Sub FillEmptyTableList(bFill As Boolean)

    ’获得当前数据库中的所有非系统数据表名称

        If bFill = True Then

            Dim oTable As SQLDMO.Table

            For Each oTable In oCurrentDB.Tables

                If oTable.SystemObject = False Then

                    ’判断其不是系统数据表

                    cob_sqltable.AddItem oTable.Name

                    ’把非系统数据表名称添加到数据表信息列表框中

                End If

                Next oTable

            End If

原文转自:http://www.ltesting.net