Get The Data 'less Common As Possible' From A Collection?

May 15, 2011

Starting from a table like this:

| Code | Year |
---------------
| A01 | 2001 |
| A01 | 2002 |
| B01 | 2002 |
| C01 | 2003 |

I have to arrive to this:

| Code | Year |
---------------
| A01 | 2001 |
| B01 | 2002 |
| C01 | 2003 |

I have to group the first column (Code) and from the second (Year) I have to get the data 'less common as possible' compared to all the other records. I try to explain this with the example: for the code 'A01' I have 2 years: '2001' and '2002'. I have to take '2001' because it's the one that not recurs in the other records. In the case that there aren't available values 'Year' that not recurs in the other records, it's good to take whatever value.

The data are in the form of array in memory and to interact with them I'm useng some LINQ queries.

View 4 Replies


ADVERTISEMENT

Using Modules - Program That Uses A Tabcontrol - Each Tab Represents A Collection Of Common Tasks

Nov 26, 2011

I have a program that uses a tabcontrol. Each tab represents a collection of common tasks and, as one would expect, has a bunch of controls on it.

In my original version of this app, I simply put all functions/subs/etc related to a specific tab right in the main form class; I just divided them with lines and a few extra blank CRLF so I could jump from section to section within the code (literally named Tab1 Code, Tab2 Code, and so forth).

I am re-working the program and thought I'd use modules for this instead. So, I built all the forms and grabbed the code from the previous version, created a new module, then pasted the code into the module. VB.Net 2010 has choked all over this with a zillion errors. The functions/subs are all public, but they cannot see any of the controls on the main form. Every control that is in existence on the main form comes up as being not declared in the module.

This is the first time I've tried to use a module without a full class, and the first time I've tried referencing back to controls on the main form in this fashion (I've always just used it for functions/subs that I pass data to). Am I trying to do something here that shouldn't be done or...? I basically just want to create files so I can segregate the code into a more logical design.

View 4 Replies

Create A Generic For All The Classes Having Common Data?

Aug 2, 2010

I need to create a generic for all the classes having common data.I am having a Test.xsd dataset.In that dataset I am having 3 Table Adapter.

pgaddressTableAdapter1
pgaddressTableAdapter2
pgaddressTableAdapter3

Code is here. You can see all these classes having same methods. I want to create a generic class for these class.

[Code]...

View 2 Replies

Use A Table Input For Common Repeating Data?

Apr 19, 2011

I am coding a Student Management System using VB.NET and Access DOn the Form for Teacher Bio-Data, I want to use a table in which I can place Teacher Qualifications in a tabular format. In other words, say, the teacher had Primary, Secondary and Tertiary education. I want to put a header as Qualifications, Year and Grades. Is there any such tool in Visual Studio that I can use?

View 9 Replies

[2008] Multiple Results - Data Entries In My Database That Have A Common Field

Jan 31, 2009

I have data entries in my database that have a common field. For example:

account_id type user_id

1 new 1
2 old 3
3 new 1
4 old 1

I am using a query like this(mysql): SELECT account_id, type, user_id FROM table WHERE user_id = 1

This is just all theoretical. The problem that I am having with this is it is only returning the first result in this case account_id 1. How can I get it to find all the results with the user_id 1 because in the way I am thinking that it is failing is that it is finding only the first result and then ending?

View 1 Replies

Comparing Data In A Text File With Data In A Combo Box Collection

Apr 14, 2011

i need to be able to compare data from a text file with the collection of a combo box.My algorithm currently populates the combo box with data from the text file on the form load event.I have included an update button that updates the combo box collection.[code]

View 1 Replies

System.Data.Common.DbDataAdapter.Fill(DataSet DataSet)

May 14, 2012

I have tried everything I can to get beyond this error which shows below as <<<<< error here. It is trying to fill a dataset from a data adapter. If I change the SELECT statement to just SELECT * FROM xTable I get the correct number of records in each table. But anytime I try with a more complex statement I get the error message shown below which indicates System.Data.Common.DbDataAdapter.Fill(DataSet dataSet. I've completely erased all data and entered a new set of test data so I know there is no problem with relationships. Each table has primary key which is foreign key in other table. IS there something wrong with the Imports section: Imports System

[Code]...

View 2 Replies

Data Scrub A Collection Of Data In A Class?

Jun 2, 2011

How can I data scrub a collection of data? I am working with existing VB.NET code for a Windows Application that uses StreamWriter and Serializer to output an XML document of transaction data. Code below.

Private TransactionFile As ProjectSchema.TransactionFile
Dim Serializer As New Xml.Serialization.XmlSerializer(GetType(ProjectSchema.TransactionFile))
Dim Writer As TextWriter
Dim FilePath As String
Writer = New StreamWriter(FilePath)

[Code]...

View 1 Replies

Wpf - Loop Through A Xml And Add Data To Collection

Feb 9, 2012

I'm trying to just iterate through this xml and grab all of its data and add it to my collection(_personOC). Right now it's not working. How can I do this without having to specify the id? All I did was make a dataset with a person table and saved it as a xml.

Public Property personOC As ObservableCollection(Of Person)
Get
Return _personOC

[Code]....

View 1 Replies

Outputting Data From A Collection On An ASP.net Page?

Apr 20, 2010

I've ported a page from classic ASP to ASP.net. Part of what happens in this page is that a collection of custom types is generated and then displayed via Response.Write() commands. I'd like to get the business logic separated out into a code behind file (and maybe move this all into a user control), but I can't seem to figure out how I'd actually display the collection once it's been generated. I want to specify a master page here, too, so the code can't stay inline. Here's a very stripped down version of the current code:

[Code]...

View 3 Replies

Simple Data Collection Web Form In .NET?

Jun 11, 2011

I am planning to create a webpage to collect simple information.

Name, email, phone number, college name and also their markes in each subject
Examsubject1subject2subject3subject4Result
test1 85779090pass

[code]....

When the user enter their informationa and press the SUBMIT button it should be saved into the server.

Note: I want to use grid view to gather the exam details, is it possible?

View 2 Replies

Collection Of Object's To Store/retrieve The Data

Feb 8, 2012

I like the PHP way of doing things but, it seems I am stuck with using a Collection of Object's to store/retrieve the data I need. I have my Collection loaded with my Objects's and the code to iterate through the collection, my problem is I am unable to retrieve the "key" as it would be called in PHP (I believe in this case it is actually the name of the object).

Consider the following example:

Dim xDoc As XPathDocument = New XPathDocument(fName)
Dim xNav As XPathNavigator = xDoc.CreateNavigator()

Dim sender As XPathNodeIterator

[CODE]...

As you can see, I am navigating an XML document, and creating an Object with some Key/Value pairs. The Object would look something like this if it were in JSON:

{"name":"John Smith","address1":"123 Anywhere St.","city":"This City","state":"FL"}

When I iterate though the Collection I can only get the value of the object, but I need the Key, in this instance I want "name","address1","city","state" to be stored in a variable for each iteration.

View 2 Replies

Data Management Program - JIT Collection Was Modified

Dec 21, 2011

I'm have a data management program. I've fixed everything in it, except when I run my Insert or update commands on a different computer I've installed it on, JIT tells me that the collection has be modified, it then gives me the option to continue or quit. I know it's been modified, the user knows it's been modified, how do I get rid of that?

View 10 Replies

Make A Data Driven App To Store Dvd Collection

May 12, 2009

I am using VS2008 Pro. I have a simple DVD database built. I'm trying to make a data driven app to store my dvd collection.One of my tables is Actors and is structured as follows.[code]On a form in my app I have a combobox. I'm trying to make it list FirstName LastName ie. Will Smith. I know how to make a query that'll take the LastName and FirstName fields and list it as Actor. I'm having a heck of a time getting it to do that in the combobox as it'll only let me use one field for the display and won't let me use the query I've made.[code]I keep getting some error about schema don't match default query. I know I could simply change the table to only have one field that holds first and last name, but from what I understand that's not proper db practice. I've searched this site and google until I was blue in the face at looking at soulutions that don't match what I'm trying to do.

View 3 Replies

MVC Data Annotation Validation Rule For Collection?

Dec 2, 2010

Is there a dataannotation validate rule for a collection based property? I have the following
<DisplayName("Category")>
<Range(1, Integer.MaxValue, ErrorMessage:="Please select a category")>
Property CategoryId As Integer
<DisplayName("Technical Services")>
Property TechnicalServices As List(Of Integer)
I'm looking for a validator that I can add to the TechnicalServices property to set a minimum for the collection size.

View 1 Replies

C# - Use Linq To Do A WHERE Against A Collection Object (using Netflix Data Source)?

Sep 18, 2010

I am using LinqPad to learn Linq by querying the NetFlix OData source.Here is the query I got working which is awesome.[code].....

(Pardon all the comments...it is a testament to the fact I am experimenting and that I will change the query for various needs).There are two thing I cannot figure out.First.Let's say I only want to return the first 10 results.Second (and most importantly). I want to filter by a partial string of the genre.Each title contains a Genres collection. I want to show only Genres where the Name contains a certain string (like "Family").Even better filter using Titles where genre.name.contains "firstFilter" AND "secondFilter".Basically, I want to filter by genre(s) and I cannot figure out how to do it since Title contains its own Genres collection and I cannot figure out how to return only title that are in one or more genres of the collection.

View 3 Replies

Delete An Item From A Collection That Is Data Bound To A GridView?

Jul 22, 2011

I am creating a simple website using the language of VB.NET, I am having trouble with one part at the moment and could really use some help.

At the moment I have items that are stored in a database, when the homepage loads these items are added to a Gridview which allows the user to select the items they wish to add to their shopping cart. Once an item is selected from the gridview it is added to a collection. That collection is then added to a Session. This is the code I have for completing that task.[code]...

View 1 Replies

Update Database With Datagridview Based On Own Data-collection

Apr 17, 2010

I am populating a datagridview not with a datatable but with a list of instances of a class I created. The data for the instances is read from a database.

Looks like this:

Public Function GetSecurities() As System.Collections.Generic.List(Of Security)
Dim com As New SqlCommand
Dim rdr As SqlDataReader

[Code]....

View 13 Replies

VS 2008 : System.Data.DataSet, Which Is Not A Collection Type

Dec 30, 2009

I am trying to export a dataset to a csv file

VB
Private Sub ExportDatasetToCsv(ByVal MyDataSet As DataSet)
Dim str As New StringBuilder
For Each dr As DataRow In MyDataSet

[code]....

I am getting an error on this line: For Each dr As DataRow In MyDataSet The error is Expression is of type 'System.Data.DataSet', which is not a collection type.

View 3 Replies

.net - Storing Subcollections (filtered Versions Of The Main Collection) Inside The Collection As Cache?

Jan 15, 2010

Is it good practice to store sub-collections of item X inside a parent collection of item X for caching 'filter-queries' which are performed on the parent collection? (They won't be used together (as in color AND type).) Or is it also ok to just Loop over the collection and return the correct entities in a temporary collection?

[Code]...

View 1 Replies

C# - Edit List Collection : Error Note Collection Was Modified - Enumeration Operation May Not Execute?

Sep 7, 2011

I have the following classes:

Product, Service and OrderItem

Product and Service must inherit OrderItem. So basically I want to store OrderItem object in my shopping cart and these object are store in a list.

Public MustInherit Class OrderItem
Private m_enuItemType As TypeOfItem = TypeOfItem.None
Private m_strUserID As Integer[code].....

View 1 Replies

VS 2008 Data Send To One Item In A Collection Is Changed For All Items

Jul 30, 2009

I have a class that contains a collection of another class. See below

Public Class Spot
Private mActive As Boolean
Public Sub New()

[Code]....

View 4 Replies

Make A Custom Collection That Take Advantage Of The Collection Editor?

Feb 8, 2010

I have been researching for a couple of days now and to no avail. Does Anyone know how to make a custom collection that take advantage of the collection editor? I would like to be able to have 3 Color Values, 1 Boolean and 1 String.

View 15 Replies

Communications :: Real Time Data Collection From Socket And Storing In Excel

Jan 5, 2012

I m into automation development of FMCG products using Micro-controllers. I get real time data Barcode 2D from TCP/IP connection. My task is to compare the result do some Computation with them and Store the incoming Barcode and results into a Excel sheet in a folder. I m successful with the basic working. Am currently working at slow speed of 1 barcode(22 char info) per second from the TCP/IP data (barcode scanner). Now, comes the real issue. I need to process atleast 5 barcodes per sec ( <200ms per process). I m partially successful with 3 Barcode per second(300 ms per process). so, thats like 300ms per processing. I need to achieve less than 200ms for entire processing. I have used threads and timers. but I m unable to achieve. Seems like storing in Excel takes more than 250ms. Since i come from micro controllers background 1msec is a lotta time to process for me. I m not sure how much time does it take and trust me i find it difficult to guage the time here.

View 1 Replies

Wpf - Data Binding A Collection Dependency Property To A Menu In User Control

Jul 27, 2011

I have a user control with its own context menu, however I need to add additional items to that menu.

The approach I took was to have a dependency property called ContextMenuItems:

Public Shared ReadOnly ContextMenuItemsProperty As DependencyProperty = DependencyProperty.Register("ContextMenuItems", GetType(ObservableCollection(Of MenuItem)), GetType(SmartDataControl), New FrameworkPropertyMetadata(New

[Code].....

View 1 Replies

.net - Collection Initializes For Read-only Collection Properties?

Jul 25, 2011

I'm trying to support Basic.NET on my framework so I'm trying to convert C# 4 code to Basic.NET 10. Microsoft is committed to "co-evolve" these two but I'm having a problem with collection initialization... I found that I can initialize a collection much like in C#:

[Code]...

View 6 Replies

.net - Search The Collection Of A Collection In LINQ Where Clause?

Apr 15, 2009

I've got the following ADO.NET Entity Framework Entity Data Model:I want to find all the Policyholders with both a Service of a given Id and also a Keyword of a given Status.

This LINQ Does Not Work:

Dim ServicesId As Integer = ...
Dim KeywordStatus As Integer = ...
Dim FoundPolicyholders = From p As Policyholder In db.PolicyholderSet.Include("Keywords").Include("Services") _
Where p.Services.Id = ServicesId _
And p.Keywords.Status = KeywordStatus _
Select p

The Where clause cannot search the p.Services and p.Keywords EntityCollections in that way.

[Code]...

View 1 Replies

Accessing And Adding Items To A Collection That Is In A Collection?

Apr 6, 2012

currently in my application I have a Global Collection that is a Collection of Collections.Currently I am trying to add items/ elements to one of the child collections of the Global Collection but I am unable to use the collections methods of the child.When I assign a variable to the child collection and return the collection it is just an object with the collection inside.

Ex:
Dim GlobalCollection as New Collection
Dim ChildCollection1 as New Collection
Dim tempCurrentCollection[code]......

View 3 Replies

Collection Index Must Be In The Range 1 To The Size Of The Collection?

Dec 17, 2009

I've been working with a CMS called InsiteCreations 2008. I'm running into an error I just can't wrap my head around. I would even be willing to compensate anyone a small amount over paypal, for a solution. The error is rare in occurance, and appears when clicking about 3-4% of links to other pages within our CMS.The full code page is quite large, but there seems to be only one function associated with the error. The error also only appears when not logged into the CMS. If logged into the CMS, clicking the link simply displays the page as normal. I have already checked permissions on the page from the CMS admin console, and it is public.

The error message is as follows:

Server Error in '/' Application.Collection index must be in the range 1 to the size of the collection.
Description:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

[code]....

View 2 Replies

Search The Collection Of A Collection In LINQ Where Clause?

Apr 15, 2011

search the collection of a collection in my LINQ Where clause?

View 11 Replies







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