I work on Northwind database.server MS2008.In linq i active a sp then show me the bellow error:
Syntax :
<dxwgv:ASPxGridView ID="ASPxGridView1" runat="server"
AutoGenerateColumns="False" DataSourceID="LinqServerModeDataSource1"
KeyFieldName="CategoryID">
<Columns>
<dxwgv:GridViewCom...
How can I do this using LINQ?
var prop = new List<EventProposal>();
foreach (var eventProposal in @event.Proposals)
foreach (var service in eventProposal.Services)
{
if (!string.IsNullOrEmpty(service.LongDescription))
{
prop.Add(eventProposal);
break;
}
...
When trying to answer this question, I discovered the following:
string s = "test";
var result1 = s.Select(c => (ushort)c); // works fine
var result2 = s.Cast<ushort>(); // throws an invalid cast exception
Why does Cast<T>() fail here? Whats the difference?
...
I am getting a response back from a Google Search Appliance suggest service in the form of JSON in the following format
string jsonString = @"{ ""query"": ""t"", ""results"": [ { ""name"": ""tom"", ""type"": ""suggest"" }, { ""name"": ""tim"", ""type"": ""suggest"" }]}";
I want to sort the results list by name alphabeticaly and change...
This is a general question, but here is the specific case I'm looking for a solution to:
I have a Dictionary<int, List<string>> I want to apply various predicates to. I want one method that can take care of multiple LINQ queries such as these:
from x in Dictionary
where x.Value.Contains("Test")
select x.Key
from x in Dictionary
where ...
I have a very simple SortedSet with a CompareTo method that sorts on the basis of two class fields. As it is used, this collection can get quite big (million+ objects) and grows and grows over time. I have been using a simple Contains method to determine if a new value already exists in the collection...
As an academic exercise I am...
I am creating a function to hide all the gridview controls except the control whose name is being passed in the function.
Here this.Controls referes to controls present in the page (At compilation error is thrown although). I want to fetch all the controls of type GridView with Name property not equal to the one passed in the funtion.
...
I am working on create an Extension Method in the Linq.Dynamic project for GroupJoin. But, for some reason it will not run. The signatures seem to match.
public static IQueryable GroupJoin(this IQueryable outer, IEnumerable inner, string outerSelector, string innerSelector, string resultsSelector, params object[] values)
{
i...
I have a table with column having multiple identical values which associates with other row values.
ID HValue Limit
0005 0 350.00
0005 1 0.00
0005 2 350.00
0005 3 350.00
0025 0 20.00
0025 1 0.00
I executed the stored proc and stored t...
I have some LINQ queries which are running against objects in memory. I think they're pretty optimized, but there is a large number of objects, and sometimes the query takes a long time to run. Sometimes it takes long enough to timeout.
(This code is running as part of an Azure worker role, and it seems to time out more frequently when ...
I´m working on some validation code and having some issues with my Linq code.
What I have is a class that validates on a particular attribute (ValidationAttribute). That all works fine, ie the validation works with a class that has some properties decorated with that attribute (or subclasses of it).
What I now want to accomplish is to ...
Is it possible to write a query where we get all those characters that could be parsed into int from any given string?
For example we have a string like: "$%^DDFG 6 7 23 1"
Result must be "67231"
And even slight harder: Can we get only first three numbers?
...
Hello, I'm new to LINQ and I've been at this for hours now. I have a List<> of objects where one of the objects properties is a List of selected categories. I also have, outside of the objects, a List representing a subset of categories and I want to return all objects which contain at least one category that is also in the subset as ill...
Hi all,
I'm trying to build a utility method using Linq that will help me with a common Linq-to-Objects search.
I have a PropertyTbl object which has a reference to an Address.
I have a IEnumerable<PropertyTbl>.
I have written a helper that takes an IEnumerable<Address> and some search criteria returns an IEnumerable<Address> which whe...
Is it possible to merge the below linq query into one query?
var checkBoxes = from x in FindAll<CheckBox>()
where x.Checked
select new
{
RecordType = Type.GetType(x.Attributes["RecordType"]),
RecordId = Int32.Parse(x.Attributes["RecordId"])
...
I'm writing a tool, and the first part of that tool is to collect all the header files in our public API. The problem is, two of the header files have duplicate file names (but they reside in different folders). This will cause a problem when creating a dictionary.
Originally I wrote a foreach loop to collect FileInfo instances into a ...
I have a DataTable containing some records. Based on some conditions I have to filter records into two datatables.
Say
When row["ItemType"]==1
//Insert item into DataTable 1
When row["ItemType"]==2
//Insert item into DataTable 2
Else
//Insert item into DataTable 3
How to do this in LINQ for a DataTable that contains a...
I have an IEnumerable and I want to get a new IEnumerable containing every nth element.
Can this be done in Linq?
...
I'm trying to do this:
var collection1 = new Collection<string> {"one", "two"};
var collection2 = new Collection<string> {"three", "four"};
var result = collection1.Concat(collection2);
But the result variable is type Enumerable[System.String]
, whereas I want a Collection[System.String]
I've tried casting:
var all = (Collection<st...
PK_RPM_BTN_SETTING_ID FK_BUTTON_ID FK_ITEM_OR_PKG IS_ITEM_OR_PKG SORT_ORDER
--------------------- ------------ -------------------- -------------- ----------
1 1 1 I 1
1 2 1 P 2
1 3 ...