Reputation: 21
public void selectqueryasso()
{
CustomerOrderResult cso=new CustomerOrderResult();
var a = (from as1 in ds.orders
from as2 in ds.order_details
where (as1.oid == as2.oid)
orderby as1.pname
select new CustomerOrderResult
{
oid = Convert.ToInt32(as1.oid),
cmny =as1.cmny,
ocountry=as1.ocountry,
pname=as1.pname,
price= Convert.ToString(as1.price),
orderno= Convert.ToString(as1.orderno),
saltitle=as1.saltitle
}).ToList<CustomerOrderResult>;
GridView1.DataSource = a;
GridView1.DataBind();
}
Cannot assign method group to an implicitly-typed local variable Cannot assign method group to an implicitly-typed local variable Cannot assign method group to an implicitly-typed local variable
Upvotes: 2
Views: 4693
Reputation: 2857
You are not actually calling the ToList()
method, you are missing the parentheses there:
public void selectqueryasso()
{
CustomerOrderResult cso=new CustomerOrderResult();
var a = (from as1 in ds.orders
from as2 in ds.order_details
where (as1.oid == as2.oid)
orderby as1.pname
select new CustomerOrderResult
{
oid = Convert.ToInt32(as1.oid),
cmny =as1.cmny,
ocountry=as1.ocountry,
pname=as1.pname,
price= Convert.ToString(as1.price),
orderno= Convert.ToString(as1.orderno),
saltitle=as1.saltitle
}).ToList<CustomerOrderResult>();
GridView1.DataSource = a;
GridView1.DataBind();
}
Upvotes: 3