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 6568405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:28:25+00:00 2026-05-25T14:28:25+00:00

I got this code But I got the following errors: Error 1 Instance argument:

  • 0

I got this code

But I got the following errors:

Error   1   Instance argument: cannot convert from 'System.Collections.Generic.IEnumerable<AnonymousType#1>' to 'System.Collections.Generic.IEnumerable<System.Data.DataRow>'   

Error   2   'System.Collections.Generic.IEnumerable<AnonymousType#1>' does not contain a definition for 'CopyToDataTable' and the best extension method overload 'System.Data.DataTableExtensions.CopyToDataTable<T>(System.Collections.Generic.IEnumerable<T>)' has some invalid arguments 



 var distinctRows = (from DataRow dRow in vwBusPark.toDataTable().Rows
                                    select new { col1 = dRow["BusinessParkID"], col2 = dRow["BusinessParkID"] }).Distinct();

                dataSet.BusinessPark.Merge(distinctRows.CopyToDataTable<DataRow>(), true, System.Data.MissingSchemaAction.Ignore);

I tried this:

dataSet.BusinessPark.Merge(vwBusPark.toDataTable().Rows.Except(DataRowComparer<UC010_WizardStepBusinessParkDataSet.BusinessParkRow>.Default).CopyToDataTable(), true, System.Data.MissingSchemaAction.Ignore);

But I got this 2 errors:

Error   2   'System.Collections.Generic.IEnumerable<AnonymousType#1>' does not contain a definition for 'CopyToDataTable' and the best extension method overload 'System.Data.DataTableExtensions.CopyToDataTable<T>(System.Collections.Generic.IEnumerable<T>)' has some invalid arguments 

Error   1   Instance argument: cannot convert from 'System.Collections.Generic.IEnumerable<AnonymousType#1>' to 'System.Collections.Generic.IEnumerable<System.Data.DataRow>'
  • 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-25T14:28:25+00:00Added an answer on May 25, 2026 at 2:28 pm

    Those aren’t DataRows, so you can’t copy them to a DataTable.

    Assuming that BusinessPark has the same column names as vwBusPark, you don’t need the LINQ query at all; instead, you can just write

    vwBusPark.toDataTable().Rows.Except(...).CopyToDataTable()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I fetch images from a server? I've got this bit of code
I got started by following this awesome tutorial , but wanted to do the
I'm having some trouble understanding why this code won't work. I got it from
I've got this code: rs1 = getResults(sSQL1) rs2 = getResults(sSQL2) rs1 and rs2 and
I've got this code in a pair of button click event handlers on a
I've got this code here: SqlCommand CodeStatus = new SqlCommand(SQL, DB); DB.Open(); Reader =
I got this doubt while writing some code. Is 'bool' a basic datatype defined
I was given this code a while back. I finally got around to testing
I've got a problem with inheritance and generics. This is the code that illustrates
I got some legacy code that has this: <?PHP if(isset($_GET['pagina'])==homepage) { ?> HtmlCode1 <?php

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.