i work with C#.net and mysql.
i will fill a combo box with data from stored procedure.
but i get only 1 value.
how can i fill the combobox?
i work with C#.net and mysql.
i will fill a combo box with data from stored procedure.
but i get only 1 value.
how can i fill the combobox?
>how can i fill the combobox?
Two ways:
1. DataBinding
2. Use Items collection to add list items.
i don't found something about databinding or items collection for stored procedures with c#.
Steps:
1. Populate the datatable instance using DataAdapter's Fill method.
2. Set DataSource, DisplayMember, and ValueMember properties.
comboBox1.DataSource=dataTab_instance;
comboBox1.DisplayMember="column_name1";
comboBox1.ValueMember="column_name1";
Steps:
1. Populate the datatable instance using DataAdapter's Fill method.
2. Set DataSource, DisplayMember, and ValueMember properties.comboBox1.DataSource=dataTab_instance; comboBox1.DisplayMember="column_name1"; comboBox1.ValueMember="column_name1";
for stored procedures i don't have DataAdpter.
i have:
MySqlConnection connection = new MySqlConnection(@"User ID=root;Password=oursupport;Host=192.168.1.25;Port=3306;Database=test; Direct=true;Protocol=TCP;Compress=false;Pooling=true;Min Pool Size=0;Max Pool Size=100;Connection Lifetime=0;");
MySqlCommand command = connection.CreateCommand();
MySqlDataReader Reader;
connection.CreateCommand();
command.CommandType = System.Data.CommandType.StoredProcedure;
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.