텍스트 상자에 여러 입력과 함께 검색 버튼을 클릭하려고합니다. 나는 주위를 둘러 보았고 다른 방법을 시도했지만 어떻게 든 잘 풀리지 않았다.여러 검색 필터에 액세스
private void btn_table_Click(object sender, EventArgs e) {
try {
connection.Open();
OleDbCommand command = new OleDbCommand();
command.Connection = connection;
string query = "select [Name],[Sex],[Number] from RecordsSheet [Name] like('" + textBox1.Text + "%'),[Sex]=('" + textBox2.Text + "%'),[Number]=('" + textBox3.Text + "%'");
command.CommandText = query;
OleDbDataAdapter da = new OleDbDataAdapter(command);
DataTable dt = new DataTable();
da.Fill(dt);
dataGridView1.DataSource = dt;
connection.Close();
}
catch (Exception ex) {
MessageBox.Show("Error " + ex);
}
}