对象数组与DataTable互换
对象数组转DataTable:
http://www.cnblogs.com/shinn/archive/2008/11/12/1332323.html
DataTable转对象:
public static SignInfo selectByIDx(int pid)//根据ID查询 今天的 返回对象
{
DataTable dt = SignInfoServices.selectByID(pid);
if (dt.Rows.Count >= 1)
{
SignInfo sig = new SignInfo();
sig.Date = (DateTime)dt.Rows[0]["date"];
sig.Pid = (int)dt.Rows[0]["Pid"];
sig.FirstTime = (DateTime)dt.Rows[0]["FirstTime"];
sig.LastTime = (DateTime)dt.Rows[0]["LastTime"];
sig.Mark = (string)dt.Rows[0]["Mark"];
return sig;
}
return null;
}