《〈〈〈〈〈〈高手帮忙:查询后再查询的问题?? 你为什么不在查询的时候jion两张表在传出结果 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 是客户要求的,先通过下拉列表选中的条件进行查询,因为查出的数据会很多,所以要再在查询后的结果中进行查询。另外,原来是用sql的,现在改用Oracle了。oracle8i不支持join语句的。 在查询时可考虑用相应的dataview来实现 我知道啊。但就是对dataview 不熟啊。有谁能指点一下啊。最好有代码。 不能重新查询一次数据库?第1次select * from xx where name=123第2次select * from xx where name=123 and sex=1差不多就这种思路! 我以前就是用的这种思路,我现在是想在查询后的结果中能够继续查询。我用dataview试过了,没成功,我对dataview不熟。有人有更好的方法吗。 dataview中可以设置rowfilter可以实现二次查询比如dataview.rowfilter="a='d'" 能说的再详细点吗。dataview我不太熟悉。 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" );} 我就是不想用临时表的啊。看来是我还没说清。我第一次查询的结果,就是dataset中的数据。我的意思是第二次查询能不能在dataset中获取结果。 这样设置dataview的RowFilterstring 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; 用DataView.RowFilter="指定要显示行的表达式" DataGrid.DataSource=DataView DataGrid.DataBind()-------努力学习 不断实践 虚心讨教-------- // 修改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; // 修改成dvDataGrid1.DataBind();这样改一下,可以吧。 怎么引用System.linq 页面设置默认按钮 怎么根据焦点来设置 如何取ajax生成的下拉列表的值? 帮个忙解析个正则表达式 解决就结贴 C#中RSACryptoServiceProvider生成大素数 在线等高手救我 刚做完一个弹出窗口控件,效果还不错 救命啊,急出病来了:DataGrid绑定dropdownlist的问题? 请教;我得数据导入e到xcel中,有的页面导入时出现数据乱码,有的页面正常? 急,老是出现这样的错误? ><**.NET 中的高级问题!非一般人会的!需要解决!**>< 做的一个新闻发布页面!!没有按照自己想的显示~有源程序~
select * from xx where name=123第2次
select * from xx where name=123 and sex=1差不多就这种思路!
比如dataview.rowfilter="a='d'"
//获取与排序顺序中的筛选器以及指定的状态相匹配的所有 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" );
}
看来是我还没说清。我第一次查询的结果,就是dataset中的数据。我的意思是第二次查询能不能在dataset中获取结果。
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;
DataGrid.DataSource=DataView
DataGrid.DataBind()
-------努力学习 不断实践 虚心讨教--------
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();这样改一下,可以吧。