Combo box data binding

Aliyu 0 Reputation points
2023-02-18T16:33:24.8633333+00:00

How to specify an Sql statement as a data source for a combo box control.
Example "Select Fld1 From DboTable Where Fld2 = SetValue"

I'm coming from Access VBA where such is done easily.

Community Center | Not monitored
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ronen Ariely 15,206 Reputation points
    2023-02-19T03:36:22.87+00:00

    Hi,

    A combo box is graphical user interface widget combination of a drop-down list. The use of combo box depend on the technological and language which you use (and you gave us no information about that)

    (1) In general, first you need to connect the database which is done using connection string that include the connection parameters.

    In the following link you can find samples of connections string to SQL Server: https://www.connectionstrings.com/sql-server/

    (2) Once you connected the database then you can use the query in order to get the data which you need. Again, the way you use the query depend on the language and tech you are using.

    The following recording provide a full explanation step-by-step to connect Dropdown List (ComboBox) to SQL Server using he tech .Net with the language VB.NET

    https://youtu.be/qaMLTIxRC1o

    And here is another recording and a simple support explanation (all from a simple search in Google):

    https://youtu.be/3LIOcTLPh80

    https://support.microsoft.com/en-us/office/use-values-from-a-sql-server-database-to-populate-a-list-box-drop-down-list-box-or-combo-box-8561c828-ef15-4235-8e9d-48915c3ce999

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.