Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 05, 2013 01:07 AM by Peter Cong
Member
527 Points
681 Posts
Jan 05, 2013 12:40 AM|LINK
Hi, I have the following codes on my web form,
if (!Page.IsPostBack)
{
string LineKey = Request.QueryString["CommitLineKey"];
ProductEntities context = new ProductEntities();
var result = from c in context.CommitLines
where c.CommitLineKey == Int32.Parse(LineKey) // I think the problem may be here
select c;
CommitLine ResultCom = result.First();//But here gets the run time error as below:
" LINQ to Entities does not recognize the method 'Int32 Parse(System.String)' method,
and this method cannot be translated into a store expression."
....
This is run time error, anybody know how to fix the problem? Thanks a lot,
All-Star
36280 Points
7394 Posts
Jan 05, 2013 12:56 AM|LINK
Jan 05, 2013 01:07 AM|LINK
oned_gk try : int LineKey = Convert.int32(Request.QueryString ["CommitLineKey"]);
Thanks a lot for the quick response, change it to Convert.ToIn32 works perfect
Peter Cong
Member
527 Points
681 Posts
Anybody knows why I get this run time error regarding to LINQ code?
Jan 05, 2013 12:40 AM|LINK
Hi, I have the following codes on my web form,
if (!Page.IsPostBack)
{
string LineKey = Request.QueryString["CommitLineKey"];
ProductEntities context = new ProductEntities();
var result = from c in context.CommitLines
where c.CommitLineKey == Int32.Parse(LineKey) // I think the problem may be here
select c;
CommitLine ResultCom = result.First();//But here gets the run time error as below:
" LINQ to Entities does not recognize the method 'Int32 Parse(System.String)' method,
and this method cannot be translated into a store expression."
....
This is run time error, anybody know how to fix the problem? Thanks a lot,
oned_gk
All-Star
36280 Points
7394 Posts
Re: Anybody knows why I get this run time error regarding to LINQ code?
Jan 05, 2013 12:56 AM|LINK
Suwandi - Non Graduate Programmer
Peter Cong
Member
527 Points
681 Posts
Re: Anybody knows why I get this run time error regarding to LINQ code?
Jan 05, 2013 01:07 AM|LINK
Thanks a lot for the quick response, change it to Convert.ToIn32 works perfect