public IList<Point> GetAllPonitPage(int start, int limit)
{
string sql = "select top " + limit + "* from Led_Point where Id not in(select top " + start + " Id from Led_Point order by Id asc) order by Id asc";
SqlDataAdapter sda = new SqlDataAdapter(sql, "server=.;uid=sa;pwd=sa;database=Led2010");
DataSet ds = new DataSet();
sda.Fill(ds);
IList<Point> result = new List<Point>();
for (int j = 0; j < ds.Tables[0].Rows.Count; j++)
{
Point _t = (Point)Activator.CreateInstance(typeof(Point));
PropertyInfo[] propertys = _t.GetType().GetProperties();
foreach (PropertyInfo pi in propertys)
{
for (int i = 0; i < ds.Tables[0].Columns.Count; i++)
{
// 属性与字段名称一致的进行赋值
if (pi.Name.Equals(ds.Tables[0].Columns[i].ColumnName))
{
// 数据库NULL值单独处理
if (ds.Tables[0].Rows[j][i] != DBNull.Value)
pi.SetValue(_t, ds.Tables[0].Rows[j][i], null);
else
pi.SetValue(_t, null, null);
break;
}
}
}
result.Add(_t);
}
return result;
}