This is a migrated thread and some comments may be shown as answers.

Parameter detected, but not found

4 Answers 59 Views
LINQ (LINQ specific questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Roman
Top achievements
Rank 1
Roman asked on 08 Jul 2009, 08:48 AM

Hi

I'm rather new to coding ASP.NET(C#), therefore I'd really appreciate some help for the following error:

I get an error when when the second linq is executed:


var protocolquery = from a in ScopeFactory.GetScope(ScopeID).Extent<Protocol>() 
                    select a; 
var scprotocoltmp = from sc in protocolquery 
                    where sc.SectionProtocols.Contains(section) 
                    select sc; 
if (scprotocoltmp.Count() > 0) 

You can see it in the context in the images below.

SectionProtocols is a collection of Protocol, containing multiple Sections. (That's why I use "Contains", to search the List).

Thanks in advance for your help!
Regards
Deidn

Screenshot links:

http://yfrog.com/eqsiteij
http://yfrog.com/5t95717762j

4 Answers, 1 is accepted

Sort by
0
Accepted
Zoran
Telerik team
answered on 15 Jul 2009, 05:34 AM
Hi Roman,

Could you try uniting both queries into one. The query should give you the desired result set if you alter it like the following:

var protocolquery = from a in ScopeFactory.GetScope(ScopeID).Extent<Protocol>()  
                    where a.SectionProtocols.Contains(section)
                    select a;  


Best wishes,
Zoran
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Roman
Top achievements
Rank 1
answered on 20 Jul 2009, 11:18 AM
That's it, you're right!
So does this mean that in case I use two queries I must somehow execute the previous IObjectScopeQuery before I'm able to further use it?

Thanks alot for your solution!

greetings
Roman
0
Accepted
Zoran
Telerik team
answered on 24 Jul 2009, 07:05 AM
Hello Roman,

It is preferable, but not always obligatory. You could split your query in two as well but the first should look like:
var protocolquery = ScopeFactory.GetScope(ScopeID).Extent<Protocol>();  
That way you could also execute the second query as you originally intended to.
Once again, I would suggest you using one query instead of splitting it to two.

Sincerely yours,
Zoran
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Roman
Top achievements
Rank 1
answered on 24 Jul 2009, 07:54 AM
Ok great, good to know, thanks a lot!

All the best
Roman
Tags
LINQ (LINQ specific questions)
Asked by
Roman
Top achievements
Rank 1
Answers by
Zoran
Telerik team
Roman
Top achievements
Rank 1
Share this question
or