Forum > Databases

[Solved] DBLookupCombobox & DBGrid

(1/2) > >>

Hi All,

I have 2 SQLite tables managed by 2 SQLQuery, one "Year" and the other "Outgoing Mail".
In the DBLookupComboBox appears the values ​​of the "Year" table.
In the grid, I'm looking to show only the rows that are identical to the 'id_year' field present in each table. They are joined by a ForeignKey.
is indeed a DBLookupComboBox that I have to use for this selection of the year or another component (DBCombobox, ...).
In SQL, do I need to do a table join?
I add the source too.

You have to add a Filter in your SQL

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---SQLDBGrid.SQL.Text:='SELECT * FROM DBGridTable WHERE Year=:YearParam';SQLDBGrid.ParamByName('YearParam').AsInteger:=DBLookupCombo.text.ToInteger;SQLDBGrid.Open;//Refresh DBGrid

Hi Zvoni,

Thanks for this help.
I applied the changes to my source and I got a compile error which makes sense.
I have an "illegal qualifier" error for this part: AnneeCourrierSortant_DBLookupComboBox.Text.toInteger -> courrierframe_unit.pas(161,129) Error: Illegal qualifier
Text and integer are incompatible.
In a property, no way to apply 'strtoint'.
I re-added the edited source.
I continue this research in this direction.


We can replace the "Text.ToInteger" by the "KeyValue" because when I select another year, I get the KeyValue from the integer value of the year of the "id_year" field.
Now, it is necessary to make this value coincide with that of the grid to display only the selected one.
I use a Showmessage (IntToStr(AnneeCourrierSortant_DBLookupComboBox.KeyValue) to verifie the value.
I advance !

Hi all,

I found !
The source code is attached for the correct selection when opening the file.
All you have to do is add some code to the OnChange of the DBLookupComboBox.


[0] Message Index

[#] Next page

Go to full version