一个简单的asp.net 模糊查询,请高手帮忙,谢谢

来源:百度知道 编辑:UC知道 时间:2024/07/07 18:35:00
我现在有个文本框获得啦用车单位名称,想和dt.Rows[i]["ycdw"] 模糊查询 ,除了sql语句还有什么办法

DataView dv = dt.DefaultView;
string c = "aaa";
dv.Filter = "ycdw LIKE '%" + c + "%'";

this.GridView1.DataSource = dv;

if(dt.Rows[i]["ycdw"].ToString().IndexOf("文本")>=0)
{
模糊查询OK;
}
else
不存在

字符串截取字符串长度去比对

直接设置 点空件右上角的三角 再根据提示设置数据源就行了