I am trying to get a list of the tables in a SQLite database. According to SQLite.org the table called "sqlite_master" lists all the tables and indices in the DB[1]. I have a SQlite browser tool that seems to confirm that, because it returns table names from the target DB, when this is executed: SELECT 'tables' from SQLITE_MASTER
My problem is getting the table names and the fields in each of the tables of a Database with an unknown structure. For this project, I do not know the name of the fields, because I am looking at DB's created by someone else. That means that the example included in the definition of "For Each" will not work. [0] Using Gambas, I connect to the SQlite database, then do a query: Public Sub DisplayDbInfo() Dim strDbTablesQuery As String ' The string that is the select statement Dim rsDbTableInfo As Result strDbTablesQuery = "Select name From sqlite_master WHERE type = 'table' ORDER BY name" rsDbTableInfo = $hConn.Exec(strDbTablesQuery) ' For debugging: Print "Num of Tables = " & rsDbTableInfo.Count ' 9 Tables Print "rsDbTableInfo.max = " & rsDbTableInfo.Max ' 8 Print "Num of Fields returned = " & rsDbTableInfo.Fields.Count For intCount = 0 To rsDbTableInfo.Fields.Count - 1 ' Number of Fields found Print "rsDbTableInfo.Fields[i] = " & Str(rsDbTableInfo.Fields[intCount]) Next However, all I get from the previous lines is this: (ResultField 0x1aa6718). I tried using 'Result', 'ResultField', 'Result.Felds' and other things, but I cannot get field names. How do I get the actual name of the field? paul ------------------------------------------------------------------------------ Shape the Mobile Experience: Free Subscription Software experts and developers: Be at the forefront of tech innovation. Intel(R) Software Adrenaline delivers strategic insight and game-changing conversations that shape the rapidly evolving mobile landscape. Sign up now. http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user