日期:2014-05-17  浏览次数:20825 次

求解啊,我该怎么样才能按照上面的条件吧数据重数据库里查出来啊
private void btncx_Click(object sender, EventArgs e)
  {
  if (cmdlx.Text == "全部" )
  {
  DataView view = set.Tables[0].DefaultView;
  view.RowFilter = "txtname like '%" + txtname.Text + "%'";
  DG.DataSource = view;
  }
  else if (cmdlx.Text == "智能机")
  {

  }
  else if(cmdlx.Text == "普通机")
  {

  }
  else if(cmdlx.Text == "其他")
  {
   
  }

------解决方案--------------------
直接用sql语句查写出来就好了
------解决方案--------------------
C# code
private void btncx_Click(object sender, EventArgs e)
  {
  DataView view = set.Tables[0].DefaultView;
  if (cmdlx.Text!= "全部" )
  {
  view.RowFilter = "txtname like '%" + txtname.Text + "%'";

  }
  DG.DataSource = view;