我希望能够查询包含正确记录的子集,然后查询总共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();
}
答案 0 :(得分:0)
如果PARCEL编号增加,则使用您的查询检索宗地编号。
然后:
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);