.net - Aggregate Multiple IEnumerables Of T

Jun 30, 2009

Given....

Public MasterList as IEnumerable(Of MasterItem)
Public Class MasterItem(Of T)
Public SubItems as IEnumerable(Of T)
End Class

I would like a single IEnumerable(Of T) which will iterate through all SubItems of all MasterItems in MasterList

I would like to think that there is a Linq facility to do this, or an extension method I am overlooking. I need a mechanism that works in VB9 (2008) and hence does not use Yield.

View 4 Replies


ADVERTISEMENT

How To Express'Aggregate Into' In C#

Jul 25, 2011

I have a code in VB .NET:Aggregate item In items Into Sum(item.Value)

View 3 Replies

How To Aggregate Field's Numeric Value

Nov 1, 2011

How to Aggregate field's numeric value..? in visual basic 2010.i am created a form with a datagridview and a textbox .datagridview binding with a table. in visual basic 2010 and SQL Server 2008R2

table fields and datagridview columns are like below

[Code]...

View 3 Replies

How To Use Aggregate Function In LINQ

Nov 1, 2011

I want to get the average of this query.
From d In (From c In location.Descendants("temperature")
Where c.Attribute("type").Value = "hourly" Select c).Descendants("value")
Take 3
Select d
I can see the aggregate keyword in the autocomplete dropdown, but how to apply it.

View 2 Replies

IDE :: Aggregate Query With Condition ?

May 28, 2012

i have 1 query with aggregate with condition using access

SELECT
HD.No,
SUM(IIf(DT.Status = 'A', 1, 0)) AS One,[code]...

i can run it in access but not in .Net QueryBuilder

View 2 Replies

Run Aggregate Function In Expression?

May 9, 2010

1.print the cars which are fast moving cars.

i have written this code but it shows message Cannot have aggregate function in expression[code]...

View 7 Replies

Run Aggregate Query Against A Datatable?

Mar 9, 2010

I do have a datatable filled from a flatfile (say .txt). After the datatable is populated, I manipulate the data. After datamanipulation I want to do some analysis of the content of the datatable. For this analysis, I need to aggregate the data.

To keep it simple, let's say I have single orders of customers in the datatable and now I want to get the total order amount for each customer (SQL: SELECT Customer, Count(Ordervalue) FROM Ordertable GROUP BY Customer).

View 5 Replies

Group By And Aggregate On A Calculated Column

Feb 20, 2011

how to change this Linq to Entities (VB.Net) query to Group by L2_ID column and aggregate the calculated column diff as Sum for the group.

[Code]...

View 1 Replies

LINQ - Logical Difference Between Max And Aggregate?

Apr 6, 2011

I've seen the operator Max used two different ways. The following two queries produce the same results. The MSIL code is slightly different. What is the benefit of using the Aggregate operator? Logically, is there a difference?

[Code]...

View 3 Replies

LINQ Expression Starting With From And Aggregate

May 4, 2012

[code]The LINQ query going into "result" is incomplete because I'm stumped at what is happening there. I expect FirstOrDefault to refer to refer to a single Child object at that point in the expression, but it refers to a collection of child objects. Why? What is the best way to get a list of parents that have no associated child or have a child fitting a particular condition? (My actual code will have one child max, so this sample code is not representative.)I just don't understand what the collection of FirstOrDefault could be referring to. It should really be just 1 value or nothing at all times.

View 1 Replies

VS 2010 Aggregate A Datagridview Column?

Jul 2, 2009

I am trying to aggregate a column in a datagridview. I know how to get it to work if I bind a database to it, I have several of them working perfectly, but I have one datagrid that is not bound to a database and for the life of me can not fiqure out

View 4 Replies

Interface Be Implemented Across An Aggregate/composite Class In .net?

Mar 30, 2010

VB.NET .NET 3.5 I have an aggregate class called Package as part of a shipping system. Package contains another class, BoxType . BoxType contains information about the box used to ship the package, such as length, width, etc. of the Box.

Package has a method called GetShippingRates. This method calls a separate helper class, ShipRater, and passes the Package itself as an argument. ShipRater examines the Package as well as the BoxType, and returns a list of possible shipping rates/methods.

What I would like to do is construct an Interface, IRateable, that would be supplied to the helper class ShipRater. So instead of:

[Code]...

However, ShipRater requires information from both the Package and its aggregate, BoxType. If I write an interface IRateable, then how can I use the BoxType properties to implement part of the Interface?

View 2 Replies

Converting A Traditional SQL Aggregate Query Into A LINQ One - SUM Grouping ?

May 24, 2010

I'm having trouble getting my head around converting a traditional SQL aggregate query into a LINQ one. The basic data dump works like so:

Dim result =
(From i As Models.InvoiceDetail In Data.InvoiceDetails.GetAll
Join ih As Models.InvoiceHeader In Data.InvoiceHeaders.GetAll On i.InvoiceHeaderID Equals ih.ID

[CODE].....................

What I need to really be getting out is ih.Period (a value from 1 to 12) and a corresponding aggregate value for i.ExtendedValue. When I try to Group ih I get errors about i being out of scope/context.

View 1 Replies

C# :: Aggregate Or Join Strings In Linq To Sql Query (SQL Server)?

Aug 6, 2010

Given a table like

ID | Name | City
1 | X | Y
2 | Z | Y

[code].....

View 2 Replies

Linq To Sql, Aggregate Columns ,group By Date Into Listview?

Aug 3, 2011

also i have a table called Orders with several columns, they contain information about the order and store the ID of the Customer they belong to.Question is: how can i query that table with (preferably) linq (the datacontext is from LinqToSql) to return the following dataI want to search for any entry with the matching CustomerID which took place, group them by Year, Sum the Totals respectively and add them to the listview?I now i could use lamda expressions and aggregate, its just not clear how (option infer on,db is a datacontext object,CustomerID is an int32 variable):

Dim Orders = (From order In db.Orders Where order.CustomerID = CustomerID).GroupBy(Function(p) p.Date.Year).GetEnumerator
I reckon i'd have to create an anonymous type like the following:

[code].....

View 1 Replies

MS CRM 2011 + FetchXML - Aggregate Query Limit Exceeded?

Apr 12, 2012

I've got a 2 part question: First question: I know that there is a query limit of 5,000 records when querying records, for performance reasons, but is there a limit when doing an aggregate query? If so, what is it? I need only to query the number of records and for one entity I can get a result of 39,000+ records, but for another entity I see an error message like:

[Code]...

View 1 Replies

Linq-to-Entities Aggregate A Column That Is Calculated In An External Function?

Feb 21, 2011

I want to Sum of the calculated column Red which is calculated in the Function IsRed() that return an integer.When I run the query I get the following error: Method 'Int32 IsRed(Int32)' has no supported translation to SQL.How should I rewrite this to get it to work.

[Code]...

View 2 Replies

Error : "You Have Tried To Execute A Query That Does Not Include The Spec Ified Expression 'ID' As A Part Of The Aggregate Function

Jul 1, 2009

I am working on an application in Visual Basic Express using an Access 2000 database.I am trying to get athe following SQL query to work but get an error in Access.

The query is:

SELECT [ID], [Title], [Author], [Series], [YearPublished], [ISBN], [CoverPrice], [Style], [Condition], [Signed], [Comments], Count([Title]) AS CountOfBooks, Sum([CoverPrice]) AS TotalCoverPrice
FROM tblBooks
WHERE ID=[@ID];

The error is:"You have tried to execute a query that does not include the spec ified expression 'ID' as a part of the aggragate function."

The query works fine without the 'Count' and 'CoverPrice' count and sum to the query.

View 1 Replies

.net - Aggregate The Columns To Group On The Period And Sum The Count Columns?

Jun 29, 2011

I have the below Linq query that is returning the data but I need to aggregate the columns to group on the Period and Sum the Count columns. How do I go about doing this?

LINQ
from t In tblTimes
join h In tblEngineeringDashboard_CADMachinesCounts on t.ID Equals h.TimeID
Order By t.Period

[code].....

View 1 Replies

.net - One Dataset With Multiple Results Sets (multiple Select Statements) SQL Reporting Service?

Oct 15, 2011

I have a question regarding the dataset usage in Reporting Services. I have a stored procedure which returns multiple select statements (result tables), and I created a Dataset in Reporting Services 2005 with this stored procedure. The problem is that I can not reference the second or third result table, and I can only use the first select statement fields. Is this the limitation on Reporting Services Dataset or is there a way to use multiple table results in one dataset?

View 1 Replies

Asp.net - Implement Security Trimming With A Website With Multiple Folders And Multiple Web.config Files?

Jun 18, 2012

I have a website that has highly granulised access and hence requires many web.config files. The problem is I would like to trim the menu so that only certain users will have access to certain folders. I have enabled trimming and setup roles in the sitemap, however when I access the page the menu is not show, as I am authorized to view the default page which is not in a subfolder. When I type the url of a page in sub folder's I have access.

How should I handle this:

A site map for each web.config file - don't know how this will work Removing the sub web.config file to only use a single one

View 3 Replies

Communicate From Client To Server From Multiple Clients On Multiple Requests In Socket Programming?

Jan 8, 2010

I have been struggling to find a solution for this problem. What I need to do is build a server application that accepts tcp client requests from different clients running on same port say:1003. I experimented by using asynchronous mode call backs etc. but it disconnects once connection is established and does not respond for further requests from the same client.

View 1 Replies

Call Sendinput In .net For Multiple Mouse Down Events For Multiple Emulated Mice?

Sep 13, 2011

Iam wanting touse sendinput in a dos or background type app (can be a regular app thats hidden) that emulates mouse clicks and sends mouse moves to another multimouse application. an project that im working on for my school i work at and i need to send the input to it. The overview of the project is i need to have this code be in a service that runs in the background that when a person does a gesture with my kinect code then it clicks the left mouse or sythesis it with sendinput (need mouse up and down sent for this to work). The end programs that receive input are: a program written in the multipoint sdk and mouse mischief. I though about using the default usb mouse driver as an emulated mouse driver to handle the part about creating a usb mouse device that works
since most newer computers are using usb.

View 7 Replies

SQL Performance Timeouts - Adding Multiple Rows In Multiple Tables In The Database

Sep 12, 2011

I have a vb.net web application and when a particular function runs , i get data timeouts in the rest of the application..(ie..row not found errors or column does not belong to table but it does) The function is adding multiple rows in multiple tables in the database and is running in a for loop. It seems to be all SQL related but I am not seeing anything in the error logs in SQL or in the application Right now I am assuming it is memory related where to start note..the for loop will be replaced with a bulk insert but right now I jest need to resolve the issue of the timeouts

View 1 Replies

VS 2008 Return Multiple Table Rows To Multiple Text Boxes

Feb 27, 2011

visual basic 2008 express
access 2007 db

I am attempting to fill a form with multiple rows from an access table based off of a parameterized query. My query works fine but I don't want to return one row at a time, I want to return all rows that match my query in multiple text boxes. I know that I can use a datagrid view to accomplish this, but I would prefer the look of a textboxes on a form. I have read through many books and searched the internet forums but think I may just not know what to search for as nothing has worked yet. Can anyone point me in the right direction. So far I have tried setting the text box value to the row().item(), creating a different dataset for each row, and even setting variables for the results of the query to then be passed to the text boxes. Since none of this work, I don't really have any starting code to post. If I could just get a starting point I could work from there, so don't feel the need to code anything for me, just set me in the right direction.

View 3 Replies

File I/O And Registry :: Listing Multiple Regkeys Under Multiple Keys?

Jun 13, 2012

I am trying to list all printers (PrintersConnections) under all users (HKEY_USERS)

problem is I dont know the user name keys in advance and need to exclude .DEFAULT and *_CLASSES so first I need to list all key names (%usernamekey%) directly under HKEY_USERS then for all keys that lists lsit all keys under HKEY_USERS\%usernamekey%PrintersConnections

Here is the code I have so far but I get errors about object variable not set, I suspect because of the way I doing the for each and listing the key names and then doing it again

Code:
Private Sub DetectPrntrs()
Try
Dim RemReg As Microsoft.Win32.RegistryKey

[Code].....

View 2 Replies

Making An Application That Uses Multiple WebBrowser Controls And Multiple Proxies?

Dec 17, 2009

I am making an application that uses multiple WebBrowser controls, and multiple proxies.The code for changing the proxy settings are as such:

#Region "Proxy"
Public Structure Struct_INTERNET_PROXY_INFO
Public dwAccessType As Integer
Public proxy As IntPtr

[code]....

Note: getRandomProxy gets a random proxy from a list.Problem is that whenever RefreshIESettings(getRandomProxy()) is applied, the proxy will be applied to all of the WebBrowsers, while i would need to have a unique proxy for each WebBrowser. Not having this would just error out the page in the other browsers and so on.

View 1 Replies

Insert Multiple Data With Multiple ComboBox In 1 Click?

Jun 9, 2011

i have a big problem here when i want to insert 6 data into 6 different row in 1 click.
in field @ form it have name, staff no.,items, quantity and date. We can select 6 items to insert which i use ComboBox for save the data in form. In this case, each name can choose 6 items in one time and i want to save it in database just in 1 click. that mean it will put a same name in 6 rows in a table. the look like this but it not complete...

[Code]...

View 6 Replies

Multithreading - Multiple SyncLocks If Want To Lock Multiple Things?

Jan 26, 2011

My question is, imagine I have two List(Of T) objects and a subroutine in a multithreaded environment that modifies both of these objects. I don't understand locks very well, so I'm unsure whether I can just do:

SyncLock CType(List1, IList).SyncRoot
List1.Clear()
List2.Clear()

[code]....

View 2 Replies

Open Multiple Socket Connects To Multiple Servers

Apr 4, 2012

i have a form where i wanted to open multiple socket connects to multiple servers. i defined "clientsocket" as a socket array

[Code]...

View 6 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved