List 集合类调用对象

//Attribute

namespace SfcEnd_PCK_DIP
{
class Attribute
{
public string BoarBC { get; set; }
public string TASN { get; set; }
public string WLID { get; set; }
public string Opindex { get; set; }
}
}

//类

public List<Attribute> Get_CurLineWLArrange(string TASN)
{
string sqlStr = "Select WLID,OpIndex from CurLineWLArrange where TASN="+TASN+" order by OpIndex";

SqlDataReader objReader = SQLHelper.GetReader(sqlStr);
List<Attribute> sfcEnd_UM_SMT = new List<Attribute>();
while(objReader.Read())
{
Attribute objStu = new Attribute();
objStu.WLID = objReader["WLID"].ToString();
sfcEnd_UM_SMT.Add(objStu);
}
objReader.Close();

return sfcEnd_UM_SMT;
}

//调用数据访问方法获取对象
SfcEnd_UM_SMT_Class objWLID = new SfcEnd_UM_SMT_Class();
List<Attribute> list = objWLID.Get_CurLineWLArrange("21");
if(list.Count!=0)
{
foreach(Attribute item in list)//解析对象
{
string W = item.WLID;
}
}

猜你喜欢

转载自www.cnblogs.com/Striveyoungfellow/p/11263364.html