日期:2014-05-17 浏览次数:20733 次
var strSQL = new StringBuilder(); strSQL.Append("declare @rodno varchar(50) "); strSQL.Append("set @rodno = @GetRod "); strSQL.Append("SELECT 'aaa' AS Type,a.rodNO as RodNO,a.starttime AS Starttime,b.endtime AS Endtime "); strSQL.Append("FROM PRO_COREVAD_BEGIN a,PRO_COREVAD_END b "); strSQL.Append("WHERE a.rodNO=@rodno "); strSQL.Append("AND a.rodNO=b.rodNO "); strSQL.Append("union "); strSQL.Append("SELECT 'bbb' AS Type,a.rodNO,a.starttime,b.endtime "); strSQL.Append("FROM PRO_Coresinter_BEGIN a,PRO_Coresinter_END b "); strSQL.Append("WHERE a.rodNO LIKE (@rodno+'%') "); strSQL.Append("AND a.rodNO=b.rodNO "); strSQL.Append("union "); strSQL.Append("SELECT 'ccc' AS Type,c.rodNo,a.starttime,b.endtime "); strSQL.Append("FROM PRO_CoreVacuumdegass_BEGIN a,PRO_CoreVacuumdegass_END b,PRO_CoreVacuumdegass_BatchInfo c "); strSQL.Append("WHERE c.rodNO LIKE (@rodno+'%') "); strSQL.Append("AND a.batchid=b.batchid AND a.batchid=c.batchid AND c.batchid = (SELECT MAX(batchid) "); strSQL.Append("FROM PRO_CoreVacuumdegass_BatchInfo "); strSQL.Append("WHERE rodNo LIKE (@rodno+'%')) --ddd"); SqlParameter[] parameters = { new SqlParameter("@GetRod", SqlDbType.VarChar,50) }; parameters[0].Value = rodno; var ds = SQLHelper.GetDs(strSQL.ToString(), parameters);