日期:2014-05-17 浏览次数:20539 次
public class ResultType
{
public string ATM;
public DateTime dt;
public decimal money;
}
public IEnumerable<ResultType> Search()
{
using (var db = new SqlCeConnection(engine.LocalConnectionString))
{
db.Open();
var cmd = db.CreateCommand();
cmd.CommandText = "select * from yourTable order by ATM编号,插入时间";
var row = cmd.ExecuteReader();
var founds = new List<ResultType>();
while (row.Read())
{
var obj = new ResultType
{
ATM = (string)row["ATM编号"],
dt = (DateTime)row["插入时间"],
money = (decimal)row["金额"]
};
if (founds.Count > 0)
{
var last = founds.Last();
if (obj.ATM != last.ATM
------解决方案--------------------
obj.money != last.money) //如果当前行与上一行并不重复
founds.Clear();