

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
5 messages in org.openoffice.fr.prog[prog] OOo1.1.3: Remplir une listBox| From | Sent On | Attachments |
|---|---|---|
| Ludovic CHEVALIER | Dec 20, 2004 9:47 am | |
| Tony GALMICHE | Dec 20, 2004 10:13 am | |
| Ludovic CHEVALIER | Dec 20, 2004 10:21 am | |
| Ludovic CHEVALIER | Dec 20, 2004 11:28 am | |
| Bernard Marcelly | Dec 20, 2004 11:31 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | [prog] OOo1.1.3: Remplir une listBox | Actions... |
|---|---|---|
| From: | Ludovic CHEVALIER (tens...@no-log.org) | |
| Date: | Dec 20, 2004 9:47:32 am | |
| List: | org.openoffice.fr.prog | |
Bonjour,
A défaut de pouvoir entrer des valeurs venznt de tableControl, je me rabat sur
les listBox.
Je me suis appuyer sur les macros du How-to Exemples_Macro_Pour_BDD.
J'en suis arrivé là:
"Sub Remplir_ListeBox()
dim oForm as object
dim oListBox as object
dim oContext as object
dim TabNomSources as variant
dim oSource as object
dim oConnexion as object
dim oLesTables as object
dim oLesRequetes as object
dim oStatement as object
dim oDonnees as object
dim NomSource as string
dim NomTable as string
dim SQL as string
oForm = ThisComponent.DrawPage.Forms.getByName("Standard") 'Object contenant la ListBox oListBox=oForm.GetByName("ListBox") 'Object contenant la ComboBox oContext = createUnoService("com.sun.star.sdb.DatabaseContext") TabNomSources=oContext.getElementNames() NomSource = "Tableau_De_Bord" oSource=oContext.GetByName(Nomsource) oConnexion=oSource.getconnection("","") oLesTables=oConnexion.tables 'Objet contenant toutes les tables 'Demande la table -> Défaut=1iere trouvée NomTable= "Arbo" 'Requete SQL par défaut SQL = "SELECT * FROM " & NomTable oStatement = oConnexion.CreateStatement() oDonnees=oStatement.executeQuery(SQL) If Not IsNull(oDonnees) Then oDonnees.next 'Retourne les données suivantes 'Affiche le contenu du 1ier et du deuxième champ MsgBox oDonnees.GetString(1) & " - " & oDonnees.GetString(2) End If 'Ajout le tableau comme élements de la ListBox oListBox.StringItemList=oDonnees.GetString(2) 'Selectionne le 1ier element de la ListBox oListBox.SelectedItems=Array(0) End Sub"
Tout se passe bien jusqu'à la ligne
"oListBox.StringItemList=oDonnees.GetString(2)", où
une boite d'erreur s'ouvre:
"Valeur ou type de données incorrect(e).
Types de données incompatibles"
Les données viennent d'une BD SQLite et sont en varchar.
Dans le how-to, il y'avait "TabNomSource()" qui donne la liste des tables.
S'il ne s'agit pas du même format de données, comment avoir une liste du contenu
du 2nd
champs de la table "Arbo"???
Merci,
-- Ciao!
Ludo







