0
我有这样的一段代码自动完成我的搜索文本框化妆自动完成文本框形成C#
AutoCompleteStringCollection coll = new AutoCompleteStringCollection();
DataTableReader reader=this.customerTableAdapter.GetData().CreateDataReader();
while(reader.Read()){
coll.Add(reader.GetString(0));
}
search.AutoCompleteCustomSource = coll;
是最好的方式来执行呢?或者是否有一个函数直接使自动完成源自己的列本身?
而且这个代码仅过滤头名,但是当我使用这段代码的GridView它给了我更好的搜索能力,所以它抓住了名的任何部分
private void search_KeyUp(object sender, KeyEventArgs e)
{
string outputInfo = "";
string[] keyWords = search.Text.Split(' ');
foreach (string word in keyWords)
{
if (outputInfo.Length == 0)
{
outputInfo = "(Name LIKE '%" + word + "%')";
}
else
{
outputInfo += " AND (Name LIKE '%" + word + "%')";
}
}
//Applies the filter to the DataView
myView.RowFilter = outputInfo;
}
建议请
根据我的一切适当的.. –
关键字搜索代码呢?我如何将它结合到自动完成源代码中 –