当我搜索电话号码时,它会在DataGridView
中逐行显示,但在我的TextBox
中,它会在旁边显示一个。你知道为什么吗?
var con = new OleDbConnection(
@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source="
+ Application.StartupPath + "\\db\\it.accdb");
con.Open();
var cmd = new OleDbCommand
{
CommandType = CommandType.Text,
CommandText = "select * from data where [ID] like(" + textBox9.Text + ")",
Connection = con,
};
var reader = cmd.ExecuteReader();
while (reader.Read())
{
textBox1.Text = reader["Name"].ToString();
textBox20.Text = reader["Description"].ToString();
}
con.Close();