DataView中的RowFilter不起作用 没有出现过滤效果
DataViewdv;publicvoiddv1(){stringsqlconn="IntegratedSecurity=SSPI;PersistSecurityInfo...
DataView dv;
public void dv1()
{
string sqlconn = "Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=CellphoneWeb;Data Source=FENG-ABB7091877\\SQLEXPRESS ";
SqlConnection myConnection = new SqlConnection(sqlconn);
myConnection.Open();
SqlCommand myCommand = new SqlCommand("SELECT model,brand,price,time FROM mobile", myConnection);
SqlDataAdapter Adapter = new SqlDataAdapter();
Adapter.SelectCommand = myCommand;
DataSet myDS = new DataSet();
Adapter.Fill(myDS);
myConnection.Close();
dv = myDS.Tables[0].DefaultView;
GridView1.DataSource = dv;
GridView1.DataBind();
}
protected void Button1_Click(object sender, EventArgs e)
{
dv1();
dv.RowFilter = "brand like '索爱'";
} 展开
public void dv1()
{
string sqlconn = "Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=CellphoneWeb;Data Source=FENG-ABB7091877\\SQLEXPRESS ";
SqlConnection myConnection = new SqlConnection(sqlconn);
myConnection.Open();
SqlCommand myCommand = new SqlCommand("SELECT model,brand,price,time FROM mobile", myConnection);
SqlDataAdapter Adapter = new SqlDataAdapter();
Adapter.SelectCommand = myCommand;
DataSet myDS = new DataSet();
Adapter.Fill(myDS);
myConnection.Close();
dv = myDS.Tables[0].DefaultView;
GridView1.DataSource = dv;
GridView1.DataBind();
}
protected void Button1_Click(object sender, EventArgs e)
{
dv1();
dv.RowFilter = "brand like '索爱'";
} 展开
2个回答
展开全部
protected void Button1_Click(object sender, EventArgs e)
{
dv1();
dv.RowFilter = "brand like '索爱'";
GridView1.DataSource = dv;
GridView1.DataBind();
}
{
dv1();
dv.RowFilter = "brand like '索爱'";
GridView1.DataSource = dv;
GridView1.DataBind();
}
参考资料: http://hi.baidu.com/ksfangdao
Storm代理
2023-07-25 广告
2023-07-25 广告
StormProxies是一家可靠的代理服务提供商,提供原生IP(住宅原生IP)和高匿名代理服务。以下是关于StormProxies的原生IP服务的一些信息:1. 住宅原生IP:StormProxies提供的住宅原生IP是指从真实的家庭或企...
点击进入详情页
本回答由Storm代理提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询