用了gridview显示数据  
怎么查询出其中一个字段名相同所有数据如果可以请给出相应代码,谢谢

解决方案 »

  1.   

    selec * from 表A where 字段="一样"
      

  2.   

    根据你的那个字段名和相应的值拼凑一个SQL,查询获取到一个数据集,然后绑定到GridView中显示即可。string strSQL = "select * from 你的表名 where 字段名='XXX'";
    DataSet ds = xxx(strSQL); //获取数据集的一个方法,自己写
    this.GridView1.DataSource = ds;
    this.GridView1.DataBind();
      

  3.   

    select * from Table where name link %张%
      

  4.   

    tring strSQL = "select * from 你的表名 where 字段名='XXX'";
    DataSet ds = xxx(strSQL); //获取数据集的一个方法,自己写
    this.GridView1.DataSource = ds;
    this.GridView1.DataBind();
      

  5.   

    select * from tb a
     where exists(select 1 from tb where 字段=a.字段 and id<>a.id)