软件测试开发技术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
文章来源于领测软件测试网 https://www.ltesting.net/