sherrick123
asked on
Filter a combobox using a dataset
I have a combobox that is filled in by a data set. I want to now filter all the entries that start with a 4
I tried using select and it would not work.
Here is my code
Dim rf As dsFileNetTypes.KDOT_DOC_SU BTYPERow 'filenet attribute
daFileNetTypes.Fill(DsFile NetTypes1) 'Filling the data adapter with the dataset for filenet subtype attributes
'filling in the combobox for the filenet attributes
For Each rf In DsFileNetTypes1.KDOT_DOC_S UBTYPE
cboFileNetDoc.Items.Add(rf .DOC_SUBTY PE)
Next
How do i write the select item.
Thanks
I tried using select and it would not work.
Here is my code
Dim rf As dsFileNetTypes.KDOT_DOC_SU
daFileNetTypes.Fill(DsFile
'filling in the combobox for the filenet attributes
For Each rf In DsFileNetTypes1.KDOT_DOC_S
cboFileNetDoc.Items.Add(rf
Next
How do i write the select item.
Thanks
Filter the data using whatever SQL query you're using to populate the box in the first place; if you supply your SQL query, I can help with that.
ASKER
SELECT DOC_SUBTYPE FROM dbo.KDOT_DOC_SUBTYPE
Do i modifiy it on my data adapter then??
Do i modifiy it on my data adapter then??
Change the query to:
"SELECT DOC_SUBTYPE FROM dbo.KDOT_DOC_SUBTYPE WHERE SUBSTRING(DOC_SUBTYPE,1,1) ='4'"
But now the question is: will the filter always be '4', or will it change based on user input? If so, is that input coming from a textbox, combo box, etc.?
"SELECT DOC_SUBTYPE FROM dbo.KDOT_DOC_SUBTYPE WHERE SUBSTRING(DOC_SUBTYPE,1,1)
But now the question is: will the filter always be '4', or will it change based on user input? If so, is that input coming from a textbox, combo box, etc.?
ASKER
I keep on getting an error on this part of my code
daFileNetTypes.Fill(DsFile NetTypes1) 'Filling the data adapter with the dataset for filenet subtype attributes
daFileNetTypes.Fill(DsFile
1) Were you getting that error before?
2) What error, exactly, are you getting?
3) Can you supply more code so I can see the SQL query in context?
2) What error, exactly, are you getting?
3) Can you supply more code so I can see the SQL query in context?
ASKER
Okay fixed my error. I did find out though I need entries with 44 but now when I put the following code in I get nothing??
WHERE SUBSTRING(DOC_SUBTYPE,1,1) ='44'
WHERE SUBSTRING(DOC_SUBTYPE,1,1)
ASKER
Doh... its the length of the substring....
One other note.
Is there a way to actually do the select on the when I fill the combobox
'filling in the combobox for the filenet attributes
For Each rf In DsFileNetTypes1.KDOT_DOC_S UBTYPE
cboFileNetDoc.Items.Add(rf .DOC_SUBTY PE)
Next
That way I can change the filters if the user would like to
One other note.
Is there a way to actually do the select on the when I fill the combobox
'filling in the combobox for the filenet attributes
For Each rf In DsFileNetTypes1.KDOT_DOC_S
cboFileNetDoc.Items.Add(rf
Next
That way I can change the filters if the user would like to
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Did you try something like this?
Dim table As dsFileNetTypes.KDOT_DOC_SU BTYPE = DsFileNetTypes1.Tables("KD OT_DOC_SUB TYPE")
Dim rows As dsFileNetTypes.KDOT_DOC_SU BTYPERow() = table.Select(String.Format ("Like '{0}%' ", 4))
Bob
Dim table As dsFileNetTypes.KDOT_DOC_SU
Dim rows As dsFileNetTypes.KDOT_DOC_SU
Bob
ASKER
I will give it a try Thanks Again...
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.