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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:17:43+00:00 2026-05-16T16:17:43+00:00

i have a datable and like this i have searched a datarow from the

  • 0

i have a datable and like this i have searched a datarow from the datable on the basis of some primary now i want to add that searched row to another datatable how can i achieve this please let me know

 DataTable findRows = (DataTable)ViewState["dt"];
 List<int> selectedList=(List<int>)ViewState["selectedList"];
 DataTable temp = new DataTable();

 foreach (int id in selectedList)
 {
   DataRow dr=findRows.Rows.Find(id);

 }

now i want it to add to datatable temp how can i achieve this?

  • 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-16T16:17:43+00:00Added an answer on May 16, 2026 at 4:17 pm

    First, when creating temp don’t just instantiate it as a new DataTable but instead call .Clone() on findrows to create a structurally identical DataTable.

    Second, use .ImportRow() on the second DataTable and pass it the row from the first DataTable that you’d like to copy. This should create an entirely new row in the second table with the same values as the row from the first table.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database table that looks like this: CREATE TABLE IF NOT EXISTS
I have a query that looks like this: using (MyDC TheDC = new MyDC())
I have a L2S query that looks like this: using (MyDC TheDC = new
I have a table like this: Name Tree Iron Clay Added I want to
I have a MyClassFile.cs file that looks like this: public class MyClass1 { public
Have a matrix report now that has Position, Hours and Wages for a location
Allright, this is like thousandth time when I get kinda useless information from a
I have the following php script now i want to put his script in
I have big DataTable I want to get subset of this DataTable represented as
I have two table. user and address . I am joining them like this

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.