Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6120749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:42:15+00:00 2026-05-23T15:42:15+00:00

Using the following DataTable: Dim d As New DataTable() d.Columns.Add(Product, GetType(System.String)) d.Columns.Add(Value, GetType(System.Double)) d.Rows.Add(New

  • 0

Using the following DataTable:

    Dim d As New DataTable()
    d.Columns.Add("Product", GetType(System.String))
    d.Columns.Add("Value", GetType(System.Double))

    d.Rows.Add(New Object() {"OAP1", 100.0})
    d.Rows.Add(New Object() {"EPP4", 100})
    d.Rows.Add(New Object() {"OAP1", 150.25})
    d.Rows.Add(New Object() {"OAPIN", 200.0})

I’m trying to use LINQ to identify if there are more than one of any type of product. In SQL, this would work something like:

SELECT Product FROM SOME_TABLE HAVING COUNT(*) > 1

I can’t for the life of me work out how to do this in LINQ. I was following someone who did something like this:

    Dim q = From row In d.AsEnumerable()
            Group row By New { column1 = row("Product"), column2 = row("Value") }
            Into grp
            Where grp.Count() > 1
            Select row

    For Each item In q
        ' 'q' is not declared. It may be inaccessible due to its protection level.
    Next

But I get an error when I try to actually use ‘q’. Any ideas on how I can make this work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T15:42:16+00:00Added an answer on May 23, 2026 at 3:42 pm

    Try this

    Dim duplicates = d.AsEnumerable().GroupBy(Function(i) i.Field(Of String)("Product")).Where(Function(g) g.Count() > 1).Select(Function(g) g.Key)
    
    For Each dup In duplicates
    Next
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the following function to map columns from a DataTable (passed from the
I'm exporting a CSV to firefox using the following code: string csv = dataTable.ToCSV();
I'm trying to populate a DataTable, to build a LocalReport, using the following: MySqlCommand
Using the following code I get a nice formatted string: Request.QueryString.ToString Gives me something
i am using following code to convert xml file to datatable but its just
i am using the following code to insert a datatable to an existing table
How to get layout like the following using h:selectOneRadio encapsulated within a rich:dataTable row1
I have the following VB.NET code that I am using to sort a Data.DataTable
I have a jquery datatable using the following code: // Test list table $('#dashboard_testlist_table').dataTable({
I want to insert a new row into a msaccess table using the following

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.