| re: Combo Box Help
If you want all of the records to appear, you should just use "SELECT * FROM
SERVER_MODEL ". Only use the WHERE clause when you want to get a specific
record.
"Matt" <anonymous@discussions.microsoft.com> wrote in message
news:F80B3F7F-CC04-4C89-9F08-8B0FDE9BF910@microsoft.com...[color=blue]
> Here is my problem. I am trying to get a combo box working that lists all[/color]
the models of servers that we have. This combo box is just one of many text
boxes that I have on my form. I am running a "find" that searches through my
database to find the queried server. When it finds it, it lists the
information. I want the model number of the server to be displayed in the
combo box, and when I click the down arrow on it, I want all of the other
server models to be listed, so if I want, I can change the server model.[color=blue]
>
> When I fill my dataset, only the model number of the server selected shows[/color]
up. All the other models in the table do not show up. How can I get all the
data to show up and to have the right server model selected? The code
pertaining to this combo box is below:[color=blue]
> ------------------------------------------------------------------
> da_Servers.SelectCommand.CommandText = "SELECT * FROM Servers WHERE[/color]
SERIAL_NUMBER= '" & txt_Find.Text & "' or SERVER_NAME='" & txt_Find.Text &
"'"[color=blue]
> da_Servers.Fill(ds_Servers)
>
> da_Models.SelectCommand.CommandText = "SELECT * FROM SERVER_MODEL WHERE[/color]
MODEL_ID= '" & editMODEL_ID.Text & "'[color=blue]
> da_Models.Fill(Ds_Models)
> cbo_Model.DataSource = Ds_Models
> cbo_Model.DisplayMember = "DESCRIPTION"
> ------------------------------------------------------------------
> da_servers is a dataadapter to my main SERVER table
> ds_Servers is a dataset for main SERVER table
> (Inside the server table there is a Model_ID column that links to the[/color]
model_ID column in the SERVER_MODEL table).[color=blue]
> Filling this dataset populates the editMODEL_ID.text textbox
>
> da_Models is my DataAdapter
> SERVER_MODEL is my table
> MODEL_ID is one column in the table and DESCRIPTION is the other
> editMODEL_ID is a text box containing the MODEL_ID that I want to query on
> ds_Models is my DataSet
> cbo_Model is my combo box
>
> Can anyone please offer any assistance. We have a few different people[/color]
trying to figure it out, and I am sure it is something very elementary.[color=blue]
>
> I appreciate any help you can give
>
> Matt[/color] |