15 pts.
 How to add value in the ComboBox from the database at RunTime?
I want to fetch the values from the database of a particular field in the combobox at run time...plz help me out

Software/Hardware used:
ASKED: November 11, 2008  6:19 AM
UPDATED: January 30, 2009  4:36 AM

Answer Wiki:
This code is used in a Delphi form fmUserData, and is called on form.show, not create, to ensure data in combo box is up to date The application uses MySQL server for data storage cbucurr is a combo box in form fmUserData // populate the strings list for the cbucurr combobox fmUserData.cbucurr.items.clear; // make sure the combobox strings list is empty fmUserData.qCurr.close; // qCurr is an ADO query linked to a table tCurr via an ADOConnection. //My qCurr has a fixed SQL Select string that selects all currency codes, but you could insert a // runtime select statement into the SQL.text property of qCuirr here // My fixed SQL string is simply 'Select currcode from tcurr' ie I want all codes in tcurr fmUserData.qCurr.open; // runs whatever select statement you have put in place fmUserData.qCurr.first; while (not fmUserData.qCurr.eof) do begin cbucurr.items.add(qcurr.FieldByName('currcode').asstring); // in above line, currcode is a field in the MySQL table tcurrr fmUserData.qCurr.next; end; I have the combobox set to uppercase and to sort the list automatically. Hope this helps.
Last Wiki Answer Submitted:  January 30, 2009  4:35 am  by  HalC   15 pts.
All Answer Wiki Contributors:  HalC   15 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

What programming language are you using? It will be different in each language.

 64,520 pts.

 

Kiti, to provide more information on your question — simply click the “Discuss This Answer” button. Your comment will appear below. Thanks!

 6,565 pts.

 

Uh Brent, the button actually says “ADD TO DISCUSSION”.

 64,520 pts.