Combo Box Help

G

Guest

Here is my problem. I am trying to get a combo box working that lists all 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

When I fill my dataset, only the model number of the server selected shows 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
-----------------------------------------------------------------
da_Servers.SelectCommand.CommandText = "SELECT * FROM Servers WHERE SERIAL_NUMBER= '" & txt_Find.Text & "' or SERVER_NAME='" & txt_Find.Text & "'
da_Servers.Fill(ds_Servers

da_Models.SelectCommand.CommandText = "SELECT * FROM SERVER_MODEL WHERE MODEL_ID= '" & editMODEL_ID.Text & "
da_Models.Fill(Ds_Models
cbo_Model.DataSource = Ds_Model
cbo_Model.DisplayMember = "DESCRIPTION
-----------------------------------------------------------------
da_servers is a dataadapter to my main SERVER tabl
ds_Servers is a dataset for main SERVER tabl
(Inside the server table there is a Model_ID column that links to the model_ID column in the SERVER_MODEL table).
Filling this dataset populates the editMODEL_ID.text textbo

da_Models is my DataAdapte
SERVER_MODEL is my tabl
MODEL_ID is one column in the table and DESCRIPTION is the othe
editMODEL_ID is a text box containing the MODEL_ID that I want to query o
ds_Models is my DataSe
cbo_Model is my combo bo

Can anyone please offer any assistance. We have a few different people trying to figure it out, and I am sure it is something very elementary

I appreciate any help you can giv

Matt
 
J

Jeff Molby

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 said:
Here is my problem. I am trying to get a combo box working that lists all
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.
When I fill my dataset, only the model number of the server selected shows
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:SERIAL_NUMBER= '" & txt_Find.Text & "' or SERVER_NAME='" & txt_Find.Text &
"'"
da_Servers.Fill(ds_Servers)

da_Models.SelectCommand.CommandText = "SELECT * FROM SERVER_MODEL WHERE
MODEL_ID= '" & editMODEL_ID.Text & "'
da_Models.Fill(Ds_Models)
cbo_Model.DataSource = Ds_Models
cbo_Model.DisplayMember = "DESCRIPTION"
model_ID column in the SERVER_MODEL table).
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
trying to figure it out, and I am sure it is something very elementary.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top