SQLite / .NET:获取附加数据库的表名

时间:2014-05-26 21:41:13

标签: .net sqlite system.data.sqlite

我可以像这样轻松地从System.Data.SQLiteConnection获取表名:

 Public Function GetTableNames(ByVal uCn As SQLite.SQLiteConnection, ByVal uDBName As String) As List(Of String)

    Dim nTables As New List(Of String)
    Dim dt As DataTable = uCn.GetSchema("tables")
    For Each nRow As DataRow In dt.Rows
        Dim sTableName As String = nRow(2)
        nTables.Add(sTableName)
    Next

    Return nTables

End Function

但是,我不知道如何确定我想要使用哪个数据库。 使用当前方法,表名称来自主数据库。

有人知道我怎么说想要从连接的特定数据库中获取表名吗?

1 个答案:

答案 0 :(得分:2)

GetSchema不支持附加数据库。 您已直接从system table

中读取了表名
SELECT name FROM MyOtherDB.sqlite_master WHERE type = 'table'
相关问题