Jump to content

Pesquisa com combobox

Recommended Posts


Boa Noite!

Eu estou buscando em vários sites uma pesquisa utilizando combobox(select) com banco de dados, mas tudo o que encontro são caixas de texto para o usurário escrever, mas não quero assim. Alguém pode me ajudar?

Share this post

Link to post
Share on other sites

Boas, aqui tens uma forma (que costumo usar) 

string query = "SELECT ......";

DataTable dt = new DataTable("Pesquisa");

MySqlDataReader reader;

using(MySqlConnection con = new MySqlConnection(Controle.ConSql))
	using(MySqlCommand cmd = new MySqlCommand(query, con))
   	    reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
        comboBox1.ValueMember = "campoBasedados";
        comboBox1.DisplayMember = "campoBasedados";
        comboBox1.DataSource = dt;


You can't do it, kid. But don't worry, my boy. You're not the only one. No one else can do it.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.