你为什么不在查询的时候jion两张表在传出结果

解决方案 »

  1.   

    是客户要求的,先通过下拉列表选中的条件进行查询,因为查出的数据会很多,所以要再在查询后的结果中进行查询。另外,原来是用sql的,现在改用Oracle了。oracle8i不支持join语句的。
      

  2.   

    在查询时可考虑用相应的dataview来实现
      

  3.   

    我知道啊。但就是对dataview 不熟啊。有谁能指点一下啊。最好有代码。
      

  4.   

    不能重新查询一次数据库?第1次
    select * from xx where name=123第2次
    select * from xx where name=123 and sex=1差不多就这种思路!
      

  5.   

    我以前就是用的这种思路,我现在是想在查询后的结果中能够继续查询。我用dataview试过了,没成功,我对dataview不熟。有人有更好的方法吗。
      

  6.   

    dataview中可以设置rowfilter可以实现二次查询
    比如dataview.rowfilter="a='d'"
      

  7.   

    能说的再详细点吗。dataview我不太熟悉。
      

  8.   

    DataTable dt=myDataSet.Table["mytablename"];
    //获取与排序顺序中的筛选器以及指定的状态相匹配的所有 DataRow 对象的数组。
    DataRow[] drs=dt.Select(condition...);
    比如:
    private static void GetRowsByFilter()
    {
        
        DataTable customerTable = new DataTable( "Customers" );
        // Add columns
        customerTable.Columns.Add( "id", typeof(int) );
        customerTable.Columns.Add( "name", typeof(string) );    // Set PrimaryKey
        customerTable.Columns[ "id" ].Unique = true;
        customerTable.PrimaryKey = new DataColumn[] { customerTable.Columns["id"] };    // Add ten rows
        for( int id=1; id<=10; id++ )
        {
            customerTable.Rows.Add( 
                new object[] { id, string.Format("customer{0}", id) } );
        }
        customerTable.AcceptChanges();    // Add another ten rows
        for( int id=11; id<=20; id++ )
        {
            customerTable.Rows.Add( 
                new object[] { id, string.Format("customer{0}", id) } );
        }    string strExpr;
        string strSort;
        
        strExpr = "id > 5";
        // Sort descending by column named CompanyName.
        strSort = "name DESC";
        // Use the Select method to find all rows matching the filter.
        DataRow[] foundRows = 
            customerTable.Select( strExpr, strSort, DataViewRowState.Added );
        
        PrintRows( foundRows, "filtered rows" );    foundRows = customerTable.Select();
        PrintRows( foundRows, "all rows" );
    }
      

  9.   

    我就是不想用临时表的啊。
    看来是我还没说清。我第一次查询的结果,就是dataset中的数据。我的意思是第二次查询能不能在dataset中获取结果。
      

  10.   

    这样设置dataview的RowFilter
    string strFilter="bdxh='"+this.ddlBdmc.SelectedItem.Value.ToString()+"'"+
    " and flxh='"+this.ddlSgxmlb.SelectedItem.Value.ToString()+"' and sgbw='"+this.ddlSgbw.SelectedItem.Value.ToString()+"'";
    DataView dv1=new DataView();
    dv1=this.dsBind.Tables["cm_jcclxmb"].DefaultView;
    dv1.RowFilter=strFilter;
      

  11.   

    用DataView.RowFilter="指定要显示行的表达式"
      DataGrid.DataSource=DataView
      DataGrid.DataBind()
    -------努力学习 不断实践 虚心讨教--------
      

  12.   

    // 修改
    DataView dv ;if (!IsPostBack){DataTable dt=null;
    OracleDataAdapter sd=new OracleDataAdapter("select a.producid,a.Productname,a.Producttype,a.Productgroup,c.unitsname,b.Stylename,a.Price1,a.Price2,a.Price3,a.Memo from twproduct a , twstyle b,twunits c where a.Productstyleid =b.Styleid  and a.Unitsid  = c.unitsid and Productstyleid ='" + DropDownList1.SelectedItem.Value.ToString() + "'",cn);
    DataSet ds=new DataSet();
    sd.Fill(ds);
    dt=ds.Tables[0];
    // 修改:
        dv = dt.DefaultView ;
        Session["DataView"] = dv ;
    } else {
    //修改如下:
        // 从上次查询中得到结果
        dv = (DataView)Session["DataView"] ;
        dv.RowFilter = "....你的条件..." ;
        
    }DataGrid1.DataSource=dv; // 修改成dv
    DataGrid1.DataBind();这样改一下,可以吧。