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;
}

相关文章:

  • 2022-03-04
  • 2021-10-05
  • 2022-02-20
  • 2022-12-23
  • 2022-02-08
  • 2021-11-23
  • 2022-02-27
猜你喜欢
  • 2021-11-10
  • 2021-09-07
  • 2021-10-15
  • 2021-08-21
  • 2021-12-13
相关资源
相似解决方案