SQlite column in comboBox

:sign0085:

How to get content of one row from table in combo box, where SQL query is:

B4X:
SELECT group FROM items GROUP BY group

I want to have groups of items showed in combo box directly from database and then when user choose one group, to use that group to show only items from that group

B4X:
SELECT * From items WHERE groupa='choosed from combox'
 

berndgoedecke

Active Member
Licensed User
Longtime User
Column in a Box

Hello Warlock051,
in my Sqlite based Application I fill a ComboBox with distinct Values from a querry.
I have to push a Button to fill it, so there is this Sub to do it:

Sub FPBDist_Click 'FPBDist = Button
SCText = StrEx.Trim(FPsC.Text)
SuText = FPTBSuch.Text
FPdC.Clear
DistStr = "SELECT DISTINCT " & Chr(34) & SCText & Chr(34) & " FROM [" & Main.AktTab & "] ORDER BY " & Chr(34) & SCText & Chr(34)
Di = 0 'Combobox Index Counter
Da = 1 'Actual Index to realise: Combobox entry = SCText
Main.cmd.CommandText = DistStr
Main.reader.Value = Main.cmd.ExecuteReader
Do While Main.reader.ReadNextRow = True
DistTStr = Main.reader.GetValue(0)
FPdC.Add(DistTStr)
If DistTStr = SuText Then
Da = Di 'Index for SCText combobox entry
End If
Di = Di +1
Loop
If SuText = "" Then
Da = 1
End If
Main.reader.Close
LbAnz.Text = FPdC.Count & " different values " 'LbAnz = Label shows Count values
LbAnz.BringToFront
FPdC.SelectedIndex = Da
End Sub

I hope it's helpful

Best Regards

berndgoedecke
 
Top