助けてくれてありがとう!!私はあなたの提案を使用し、いくつかの小さな変更を加えましたが、それは私にとってはうまくいきます...
唯一の問題は私のメソッドリストであることが判明しました.List < String >を変更すると、状況は改善されました。不思議に思っている人のために、これが私がそれを行う方法です:
ダル層:
public List<string> LoadList()
{
List<string> tagsList = new List<string>();
using (SqlConnection connection = new SqlConnection(ADados.StringDeConexao))
{
connection.Open();
using (SqlCommand command = connection.CreateCommand())
{
command.CommandText = "SELECT column FROM table";
using (SqlDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
if (!reader.IsDBNull(0))
tagsList.Add(reader.GetString(0));
}
reader.Close();
}
connection.Close();
return tagsList;
}
プレゼンテーション層 (イベント TextChanged):
PedidoBLL pedido = new PedidoBLL();
txtName.AutoCompleteMode = AutoCompleteMode.Suggest;
txtName.AutoCompleteSource = AutoCompleteSource.CustomSource;
AutoCompleteStringCollection popula = new AutoCompleteStringCollection();
popula.AddRange(pedido.LoadList().ToArray());
txtName.AutoCompleteCustomSource = popula;
BLLレイヤーでは、DALメソッドLoadListを呼び出して返すだけです...