模糊查询实现

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;

        }

 

posted on 2012-06-16 12:02  烟雨飘零  阅读(149)  评论(0编辑  收藏  举报

导航