StringBuilder sql1 = new StringBuilder( "select top "+15*CurrentPage+" WTPROD,WTTOOL from I_ToolPlan where 1=1 "); if(a !="" )
{
sql1.Append( " and WTPROD between '"+a+"' and '"+b+"' ");
}
if(c != "")
{
sql1.Append(" and WTTOOL between '"+c+"' and '"+d+"'");
}
sql1.Append("order by WTTOOL desc ");
StringBuilder sql2 = new StringBuilder( "Select Top 15 x.* from I_ToolPlan x left join ("+sql1+")y on x.WTPROD=y.WTPROD and x.WTTOOL=y.WTTOOL where 1=1 "); if(a != "" )
{
sql2.Append( " and x.WTPROD between '"+a+"' and '"+b+"' ");
}
if(c != "")
{
sql2.Append(" and x.WTTOOL between '"+c+"' and '"+d+"'");
}
sql2.Append("and y.WTTOOL is null order by x.WTTOOL desc");
SqlDataAdapter MyAdapter = new SqlDataAdapter(p_wsp, MyCon());
MyAdapter.SelectCommand.CommandType = CommandType.StoredProcedure;这样调用存储过程,但是存储过程里面有两条select语句,SqlDataAdapter(p_wsp, MyCon());会执行那条语句?
StringBuilder sql1 = new StringBuilder( "select top "+15*CurrentPage+" WTPROD,WTTOOL from I_ToolPlan where 1=1 "); if(a !="" )
{
sql1.Append( " and WTPROD between '"+a+"' and '"+b+"' ");
}
if(c != "")
{
sql1.Append(" and WTTOOL between '"+c+"' and '"+d+"'");
}
sql1.Append("order by WTTOOL desc ");
StringBuilder sql2 = new StringBuilder( "Select Top 15 x.* from I_ToolPlan x left join ("+sql1+")y on x.WTPROD=y.WTPROD and x.WTTOOL=y.WTTOOL where 1=1 "); if(a != "" )
{
sql2.Append( " and x.WTPROD between '"+a+"' and '"+b+"' ");
}
if(c != "")
{
sql2.Append(" and x.WTTOOL between '"+c+"' and '"+d+"'");
}
sql2.Append("and y.WTTOOL is null order by x.WTTOOL desc");
返回两个select结果集