模糊查询实现
Datatable dv=null; dv = dtbProductInfo.Clone(); DataRow[] temp = dtbProductInfo.Select("product_figure like '*" + txtProduct.Text.Trim() + "*'"); dv.Rows.Clear(); for (int i = 0; i < temp.Length; i++) dv.ImportRow(temp[i]); this.dgvProductInfo.DataSource = dv; private void txtProductFigure_TextChanged(object sender, EventArgs e) { DataView dv = dstProject.Tables["dtblProject"].DefaultView; dv.RowFilter = "PRODUCT_FIGURE like '%" + txtProductFigure.Text.ToString() + "%'"; dv.RowStateFilter = DataViewRowState.OriginalRows; this.dgvlProject.DataSource = dv; }