SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,714 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello ;
My code works like this. But when I click on the column header, it doesn't sort.
db.satis.Where(x => x.Tarih >= baslangic && x.Tarih <= bitis).OrderByDescending(x => x.Tarih).Load();
var Satislar = db.satis.Local.ToBindingList();
List<satis> result = Satislar
.GroupBy(l => l.Barkod)
.Select(cl => new satis
{
UrunAd = cl.Select(x => x.UrunAd).FirstOrDefault(),
Barkod = cl.Select(x => x.Barkod).FirstOrDefault(),
Miktar = cl.Sum(x => x.Miktar)
})
.OrderBy(x => x.Miktar)
.ToList();
dataGridView2.DataSource = result;
When I write the code like this, an error occurs.
db.satis.Where(x => x.Tarih >= baslangic && x.Tarih <= bitis)
.GroupBy(es => es.Barkod)
.Select(f =>new satis
{
UrunAd = f.Select(x => x.UrunAd).FirstOrDefault(),
Barkod = f.Select(x => x.Barkod).FirstOrDefault(),
Miktar = f.Sum(x => x.Miktar)
})
.OrderByDescending(x => x.Miktar)
.Load();/*
var result = db.satis.Local.ToBindingList();
dataGridView2.DataSource = result;