Click here to Skip to main content
15,124,187 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Okay so i have already written code to allow my database to insert an ID into my combobox. I have 2 ID types. An admin ID and a User ID. My problem is that it shows both the user and admin ID's in the combobox. How would i make it so that it only contains say the users Id number. My columns in my database are Id number and Id Type. Im pretty new to databases and would love to learn. Please help. I would be grateful for any feedback.

Dim cm As New MySqlCommand("SELECT IDType FROM TBL ", MySQLConnection) '

Dim sa As New MySqlDataAdapter(cm)


I want to make it so that only the users ID shows and not the admins.

What I have tried:

everything im pretty new so helpp please
Updated 29-Jan-19 4:20am

1 solution

The easiest way would be to filter the admins out at the database level. This is very easy to do using the WHERE clause.
How easy? This is basically all that is needed
SELECT id FROM tbl WHERE idtype = 'user'
Documentation: w3 Schools: SQL WHERE[^]
Member 13458722 22-Jan-19 16:53pm
I love you my friend. You a great human being.
MadMyche 22-Jan-19 19:39pm
You're welcome

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900