用RowFilter
http://xml.sz.luohuedu.net/xml/ShowDetail.asp?id=12912741-070C-41DE-8D08-50C8DDA1F864

解决方案 »

  1.   

    select * from yourtable where cast(id as int) % 2 != 0
      

  2.   

    SELECT *
    FROM table
    WHERE (file % 2 <> 0)
      

  3.   

    select * from yourtable where cast(id as int) % 2 != 0
      

  4.   

    table1(id int,name varchar(10))
    public class WebForm1 : System.Web.UI.Page
    {
    protected System.Web.UI.WebControls.DataGrid DataGrid1;
    protected System.Web.UI.WebControls.Button Button1; DataSet ds=new DataSet();

    private void Page_Load(object sender, System.EventArgs e)
    {
    BindData();
    }
    private void BindData()
    {
    SqlConnection sc=new SqlConnection("server=10.10.1.196;database=pubs;uid=zxy;pwd=zxy");
    SqlDataAdapter sd=new SqlDataAdapter("select * from table1",sc);
    sd.Fill(ds,"table1"); for (int j=0;j<=ds.Tables[0].Rows.Count-1;j++)
    {
    System.Data.SqlTypes.SqlInt16 i;
    i=System.Data.SqlTypes.SqlInt16.Parse(ds.Tables[0].Rows[j]["id"].ToString());

    if (System.Data.SqlTypes.SqlInt16.Mod(i,2)==0)
    ds.Tables[0].Rows.RemoveAt(j);
    }

    DataGrid1.DataSource=ds.Tables[0].DefaultView;
    DataGrid1.DataBind();
    }
      

  5.   

    我说一下大概的思路
    你可以把结果集DataSet的奇数部分分出来
    用forech(DataRow myRow in myDataSet)
      {
         如果是奇数添加到newDataSet;
       }
    然后你把newDataSet 绑定到DataGrid
      

  6.   

    SELECT *
    FROM table
    WHERE (id % 2 <> 0)
      

  7.   

    SELECT *
    FROM table
    WHERE (id / 2 <> 0)  access 中通过验证
      

  8.   

    很简单,就是建立一个DataSet11
    Select语句设置为
    SELECT *
    FROM table
    WHERE (id / 2 <> 0)
    然后进行绑定
    sqlDataAdapter.Fill(DataSet11,"Table");
    this.DataGrid1.DataSource=DataSet11;
    this.DataGrid1.DataBind();
    就OK了
      

  9.   

    sql="select * from table order by id"for(int i=0;i<datatable.count;i++)
    {
    }
      

  10.   

    select * from yourtable where cast(id as int) % 2 != 0 这个是绝对可行的,放到windows自动生成代码部分的select部分
      

  11.   

    SELECT *
    FROM table
    WHERE (id%2 <> 0) and id<100100条以内数据,SQL 中也通过
      

  12.   

    sorry!sql="select * from table order by id";cpydatatable=datatable.copy();for(int i=0;i<datatable.count;i++)
    {
       if(datatable.row[i]["id"]%2==0)
          cpydatatable.row[i].Delete()
    }DataGrid.DataSource=cpydatatable.DefaultView;
      

  13.   

    SELECT *
    FROM table
    WHERE (id % 2 <> 0)这种方法要求你的数据库的格式有ID字段(种子)建议你采用rowfilter或者重新构建dataset