Bonjour j ai une incoherance entre le nombre de tables trouvé et la routinre ‘tables’
nb est bien valorisé a 2 mais on ne rentre jamais dans la boucle For Each … next
Me.refConnection est un MySQLCommunityServer
Try
Me.refConnection.Connect
Var row_tables As RowSet
row_tables = Me.refConnection.Tables
Var nb As Integer = row_tables.RowCount
nb = nb
Var lesTables As String
For Each row As DatabaseRow In row_tables
lesTables = lesTables + (row.ColumnAt(0).StringValue) + " - "
Next
Catch error As DatabaseException
// DB Connection error
erConnect = “Erreur: " + error.Message + " [” + error.ErrorNumber.ToString + “]”
End Try
Je ne suis pas certain que For Each fonctionne avec ce type de donnée.
La doc indique :
“Loops through the elements of a one-dimensional array or a class that implements the Iterable interface.”
Merci Eric pour ta precision
C’est un exemple de code dans la documentation:
Var tables As RowSet
tables = App.db.Tables
Try
For Each row As DatabaseRow In tables
MessageBox(row.ColumnAt(0).StringValue)
Next
tables.Close
Catch error As NilObjectException
MessageBox(“This database has no tables.”)
End Try
Merci Emile
RowCount existe bien mais n est pas disponible pour MySql !
mais dans mon cas, cela retourne bien la bonne valeur
**RowCount** As [Integer](https://documentation.xojo.com/api/data_types/integer.html)
The number of rows in the RowSet.
Currently only supported by these databases:
* [SQLiteDatabase](https://documentation.xojo.com/api/databases/sqlitedatabase.html)
* [PostgreSQLDatabase](https://documentation.xojo.com/api/databases/postgresqldatabase.html)
* [OracleDatabase](https://documentation.xojo.com/api/databases/oracledatabase.html)
* [ODBCDatabase](https://documentation.xojo.com/api/databases/odbcdatabase.html), although not all ODBC drivers implement this
For databases that do not support this function, an [UnsupportedOperationException](https://documentation.xojo.com/api/exceptions/unsupportedoperationexception.html) is raised.
Cependant, je suis allé dans la documentation:
Recherche (Cmd-K | Alt+K) “MySQLCommunityServer”
Dans cette page:
Recherche visuelle dans la liste des commandes (rien)
Recherche informatique pour RowCount : pas de commande trouvée (à ce nom strict).
Ceci-dit, sauf si tu as créé le fichier ou ouvert ce fichier avec un utilitaire ad hoc, comment peux-tu savoir s‹’il y a 2 TABLEs / et ce nombre de TABLEs est-il 0-based ou 1-based ?
À propos: je n’ai jamais utilisé MySQLCommunityServer (mais SQLite: oui).