我在文本框上输入一个值,在数据库中与该值相关的其他数据自动的显示在其他的标签上。asp.net
展开全部
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);
这是像百度的那样,匹配的会显示在文本框下面,测试通过的
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);
这是像百度的那样,匹配的会显示在文本框下面,测试通过的
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询