Recently required to loop through SQLCe database to get all the names of the tables it holds. Couldn't get anywhere for a while good info about this task, while found this web article Get All SQL Database Table Names and Fields Using VB.NET | Online Marketing | Web Malama, Ft Collins, Loveland, Kona... That code worked as required for me after little changes, but.... I couldn't find any information at the moment why datarow retrieves tablename and why datarow has to be set to 2 arraynumber in code to get name (tried to set different - doesn't work). I would appreciate any info or sources...
Thanks
p.s.
here is revised code
Dim query As String = "select * from INFORMATION_SCHEMA.tables"
Dim myCmd As SqlCeDataAdapter = New SqlCeDataAdapter(query, Conn)
Dim myData As New DataSet()
myCmd.Fill(myData)
For Each table As DataTable In myData.Tables
For Each row As DataRow In table.Rows
Debug.WriteLine(row(2).ToString)
Next row
Next table
Thanks
p.s.
here is revised code
Dim query As String = "select * from INFORMATION_SCHEMA.tables"
Dim myCmd As SqlCeDataAdapter = New SqlCeDataAdapter(query, Conn)
Dim myData As New DataSet()
myCmd.Fill(myData)
For Each table As DataTable In myData.Tables
For Each row As DataRow In table.Rows
Debug.WriteLine(row(2).ToString)
Next row
Next table