我希望能够查询包含正确记录的子集,然后查询总共13行的6个前后记录,并在DGV中显示它们。拉取正确行的查询如下:
private void textBox6_Leave(object sender, EventArgs e)
{
DataClasses3DataContext db = new DataClasses3DataContext();
var matchedAdd = (from c in db.GetTable<prop>()
where c.HOUSE_NO.Contains(textBox1.Text) && c.Direction.Contains(textBox2.Text) && c.street.Contains(textBox3.Text) && c.SUFF.Contains(textBox4.Text)
select c).SingleOrDefault();
}发布于 2013-03-06 04:45:56
如果地块编号在增加,则使用查询检索地块编号。
然后:
var before = (from c in db.GetTable<prop>()
where c.PARCEL < retrievedParcelNumber orderby c.PARCEL descending
select c).Take(6);
var after = (from c in db.GetTable<prop>()
where c.PARCEL > retrievedParcelNumber orderby c.PARCEL
select c).Take(6);https://stackoverflow.com/questions/15233172
复制相似问题