I have this challenging task in VB.NET LINQ.
I have 2 databases from different servers. I cannot link the databases. The data is retrieved from the databases as :
DB1
Client_ID Engagement_ID Enabled Description
600 10 True Company1
600 20 False Company2
700 ...
I have a custom List (MyCustomList) that implements List(Of MyCustomClass).
I want to run a LINQ query against that and return a filtered MyCustomList.
Public ReadOnly Property DebitTransactions As MyCustomList
Get
Return From item In Me Where item.IsDebit = True Select item
End Get
End Property
I ...
Why are there no LINQ extension methods on RepeaterItemCollection despite the fact that it implements IEnumerable?
I'm using Linq to objects elsewhere in the same class. However, when I attempt to do so with the RepeaterItemCollection they aren't available. I was under the impression that the LINQ extension methods were available to c...
If I have a class that looks like:
public class Item
{
public int ClientID { get; set; }
public int ID { get; set; }
}
And a collection of those items...
List<Item> items = getItems();
How can I use LINQ to return the single "Item" object which has the highest ID?
If I do something like:
items.Select(i => i.ID).Max();
...
I have 2 databases from different servers. I cannot link the databases. The data is retrieved from the databases as :
DB1
- Client_ID Engagement_ID Enabled Description
600 10 True Company1
600 20 False Company2
700 10 True Company3
DB2
Client_ID Engagement_ID Enabled
Description
600 5 True Company1
600 10 False Company2
500 30 T...
I'm new to Linq to Objects, and I've just hit the problem of anonymous types and scope.
For example, this works just fine:
Public Sub CreateResults()
results = From e In CustomerList
Join f In OrderList On CustomerList.ID Equals OrderList.ID
Select New With {e.FirstName, e.LastName, f.Ord...
Hi,
I have two methods:
Public Function GetTotalLimit(ByVal entity As Entity) As Int64
Return (From c In entity.Collection
Select c.Limit).Sum()
End Function
Public Function GetTotalUsed(ByVal entity As Entity) As Int64
Return (From c In entity.Collection
Select c.Used).Su...
PREVIOUSLY: In this question someone told me how to use CompareTo to return surnames within a particular range ordered alphabetically using LINQ to Objects.
The rest of my question, which seems to have missed the initial question asking feeding frenzy, actually arose after I tested this solution. In the previous eaxample I had a list of...
I have a dataset like:
Attic Indoor Indoor
Cable Indoor Indoor
Double Indoor Indoor
Fireplace Indoor Indoor
Basketball Outdoor Outdoor
Freshwater Leisure Activities Leisure Activities
Fishing Leisure Activities Leisure Activi...
Hi,
I've this Collection for example:
1: A
2: B
3: A
4: C
5: A
6: C
I want to get the second repeated item from this collection in a LINQ query,
the required result is: 3:A, 6:C
...
I want to write an dynamic linq where i send table and column name this query return me the max row number of the table .
SELECT ISNULL(MAX(intProductCode) + 1, 1) AS intProductCode FROM tblProductInfo
Above is my T-SQL syntax.I want same output from the linq how to
If i write this bellow syntax get same out put but here i can not se...
Bellow is my .aspx aspxGridview syntax
<dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False"
KeyFieldName="intProductCode" onrowinserted="ASPxGridView1_RowInserted">
<Columns>
<dx:GridViewCommandColumn VisibleIndex="0">
<EditButton Visible="True">
...
I am trying to distinct on multiple columns and get datarows from datatable. but getting error.
Dim query As IEnumerable(Of DataRow) =
(From row As DataRow In SourceTable.AsEnumerable() _
Select row.Field(Of String)("ColumnName1"),
row.Field(Of String)("ColumnName2") ).Distinct()
below e...
I have an interesting problem to solve that would be helped by successfully casting objects created by LINQ to SQL into a single master object that I could pass around. Here is the scenario at a high level.
I have a number of stored procedures that fetch data and then all return the exact same columns. The params into the procs and th...
I would like a third column "items" with the values that are grouped.
Dictionary<string, int> dic = new Dictionary<string, int>();
dic.Add("a", 1);
dic.Add("b", 1);
dic.Add("c", 2);
dic.Add("d", 3);
var dCounts =
(from i in dic
group i by i.Value into g
select new { g.Key, count = g.Count()});
var a = dCounts.Where(c =...
I'm a bit stumped about how to perform the necessary cast in the following:
public IList<IMyClass> Foo()
{
IList<IMyClass> foo = SomeQuery();
var result = foo.GroupBy(x => x.bar).Select(x => new MyClass()).ToList();
// So now I have a List<MyClass> which needs casting as IList<IMyClass>
return result;
}
using an ex...
I'm not the greatest with LINQ, but I'm trying to retrieve all the ModuleAvailabilities where the academicYear is the current year.
Are there any improvements to be made here?
pathway.PathwayFoundationModule.Attach(
pathway.PathwayFoundationModule.CreateSourceQuery()
.Include("Module")
.Include("Module.ModuleAvaila...
I am using Linq.Dynamic. I have already added another SelectMany extension to all for creating a new anonymous object with the data. But, I have ran into another issue that I can not seem to solve.
I want to have extension method chaining as follows, but using the dynamic methods:
var customerandorderflat = db.Customers
.S...
my three table structure are :
USE [DB_OrderV2]
GO
/****** Object: Table [dbo].[tblPageInfo] Script Date: 07/24/2010 23:16:18 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tblPageInfo](
[Code] [int] IDENTITY(1,1) NOT NULL,
[PageID] [smallint] NOT NULL,
[PageName] [nvarchar](80) NOT NULL,...
<dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False"
KeyFieldName="CategoryID">
<SettingsEditing Mode="Inline" />
<Columns>
<dx:GridViewCommandColumn VisibleIndex="0">
<EditButton Visible="True"></EditButton>
<NewButton Visible="True"></NewButton>
<DeleteButton...