string selectStr = "select name from base_customers";
OleDbCommand mycommand = new OleDbCommand(selectStr, myconn);
DataSet myDataSet = new DataSet();
OleDbDataAdapter myDataAdapter = new OleDbDataAdapter();
myDataAdapter.SelectCommand =
new OleDbCommand(selectStr, myconn);
OleDbCommandBuilder builder =
new OleDbCommandBuilder(myDataAdapter);
myDataAdapter.Fill(myDataSet, "customers");
string[] arr = new string[myDataSet.Tables["customers"].Rows.Count];
for (int i = 0; i < arr.Length; i++)
{
arr[i] = myDataSet.Tables["customers"].Rows[i][0].ToString();
}
textBox1.AutoCompleteCustomSource.AddRange(arr);
这是像百度的那样,匹配的会显示在文本框下面,测试通过的
文本框有个TextChanged事件,注册这个事件后在里面 写代码连接数据库进行查询,然后把查询到的值赋给其它标签。