Please I have an autocomplete textbox which fetches value from a tabe in the database. But after i choose the name i want to get the id of the value selected and save it in the database. Am using mysql and c#.
using (MySqlConnection con = new MySqlConnection(MyConString))
{
connection.Open();
string command = "select * from suppliers";
MySql.Data.MySqlClient.MySqlCommand myCommand = new MySql.Data.MySqlClient.MySqlCommand(command, connection);
MySqlDataReader reader = myCommand.ExecuteReader();
AutoCompleteStringCollection MyCollection = new AutoCompleteStringCollection();
while (reader.Read())
{
MyCollection.Add(reader["Name_of_Supplier"].ToString());
}
txtSupplier.AutoCompleteCustomSource = MyCollection;
connection.Close();
}