Topic: combo box items
how to put item from any table using sqlexecute query..
My Visual Database → General → combo box items
how to put item from any table using sqlexecute query..
Hello blackpearl
You could use this piece of code (and adapt it to your case)
Form1.Combobox1.dbSQLExecute('Select distinct (MyfFeld) from (MyTable');
(as I already use this code in one of my projects, I added the keyword DISTINCT to avoid repeating duplicates on the MyField field).
To put behind a FormShow event for example, or behind any other event requiring this result (ButtonClick,, CheckBoxChecker ...
Hope this can help you
JB
jean. blackpearl8534,
You should also include "id" in the SELECT so you know what the id is for the specific selection in the combobox.
Hi Everyone,
You can also just manually type in ANY tablename (in the 'foreign key' property) and ANY fieldname (in the 'fieldname' property) - please see the attached screen shot.
It's quick and easy but obviously it doesn't give you the option to have just distinct records (as Jean's code does) nor does it know anything about the record's "id" (as EHW rightly points out).
Derek.
Good suggestion Derek. Actually using your method does provide the record's id through retrieving dbItemID in script.
I should have clarified a little more in my answer. It really depends on how the combobox is to be used. If it's being used as a type of lookup as normally done in MVD then placing the id in the SELECT statement should be present. However, I have done the same thing as Jean mentioned with using DISTINCT in the SELECT in situations where I did not need the id. In fact you can't put the id in the SELECT statement when using DISTINCT because it actually defeats the purpose of distinct.
hello derek.. thanks for help. i know how to configure combobox usin controls..
i want to load data from table into combobox using script..
My Visual Database → General → combo box items
Powered by PunBB, supported by Informer Technologies, Inc.
Theme Hydrogen by Kushi