Web Development

Find data with specific row upto k-item from database in Linq to sql

BindProducts(startRow);                                                                          private void BindProducts(int  startRow)                                                                 {                                                                                                        NorthwindDataContext db = new NorthwindDataContext();                       var products = from p in db.Products where p.OrderDetails.Count > 2      select  new  ID = p.ProductID,Name = p.ProductName,             NumOrders =p.OrderDetails.Count,  Revenue = p.OrderDetails.Sum(o => o.UnitPrice * o.Quantity) };                                                GridView1.DataSource = products.Skip(startRow).Take(10); GridView1.DataBind();
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s