如何将最近添加的值从数据库中获取到我的文本框(使用Autosuggest),我需要退出应用程序只是为了查看最近添加到我的文本框中的值。我希望有人能够在这件事上为我提供帮助。
public void AutoSuggest()
{
List<string> col = new List<string>();
using (var con = SQLConnection.GetConnection())
{
using (var select = new SqlCommand("Select Codeitem from employee_product", con))
{
using (var reader = select.ExecuteReader())
{
while (reader.Read())
{
col.Add(reader["Codeitem"].ToString());
}
txt_code.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
txt_code.AutoCompleteSource = AutoCompleteSource.CustomSource;
txt_code.AutoCompleteCustomSource.Clear();
txt_code.AutoCompleteCustomSource.AddRange(col.ToArray());
AddingProduct();
}
}
}
}