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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:21:26+00:00 2026-05-23T05:21:26+00:00

DataSet dsUdpated = new DataSet() DataTable dtUpdated = dsUpdated.Tables.Add(); dtUpdated = dsOriginal.Tables[0].Clone(); // Guarenteed

  • 0
DataSet dsUdpated = new DataSet()
DataTable dtUpdated = dsUpdated.Tables.Add();
dtUpdated = dsOriginal.Tables[0].Clone();   // Guarenteed ds.Tables[0] has rows
dsUpdate.Tables[0].ImportRow(row); // row is one of the filtered row in 

But the ImportRow doesnt seem to add the rows!. dsUpdate.Tables[0] doesnt contain the row. But a row is added. Please help!

  • 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-23T05:21:27+00:00Added an answer on May 23, 2026 at 5:21 am

    Here’s what you’re doing wrong.

    DataTable dtUpdated = dsUpdated.Tables.Add();
    dtUpdated = dsOriginal.Tables[0].Clone();
    

    In the first line, you are declaring your object and initializing it to the result of an Add operation on the DataSet’s Tables collection. In the second line, you are setting to to something else entirely!

    dtUpdated may very well refer to the same object in memory as dsUpdated.Tables[0] after the first line of code, but the variable itself is not a constant reference to that object. Indeed, in the second line, you have set it to a different object, the result of another table’s Clone() method. If the variable ever pointed to the same object as dsUpdated.Tables[0], it does not anymore. It’s similar to stating

    int x = 5;
    x = 6;
    

    In the first line, the value of x is 5. In the second, you’ve replaced that value with 6. Similarly, with your table variable, the value is a reference. You’ve replaced one reference with another. Make sense?

    Clone the table first, then add that table to the dataset. Now dsUpdated.Tables[0] will contain the cloned structure of dsOriginal.Tables[0] and your import should work as expected.

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

Sidebar

Related Questions

DataSet DataSet1 = new DataSet(); DataTable t = DataSet1.Tables.Add(employee); textBox1.DataBindings.Add(Text,t,salary); i wanted to know
I have a dataset that has two tables in it. I want to do
My dataset currently has 12 rows of data. Each representing data for a month.
DataSet dsQues = obj.getQues(); txtQues.Text = dsQues.Tables[0].Rows[0][Ques].ToString(); //error here
DataSet ds = DAL.GetData(); DataSet dsInvitee = null; DataTable dt = ds.Tables[0].Copy(); IEnumerable<DataRow> q1
I have a DataSet where I need to find out how many rows has
[...] public DataSet ReturnPromoMagazinesDs() { MySql.Data.MySqlClient.MySqlConnection mysqlConnection = new MySql.Data.MySqlClient.MySqlConnection(this.connectionString); MySql.Data.MySqlClient.MySqlCommand mysqlCommand = new
I have a DataSet which I get a DataTable from that I am being
Suppose I have a dataset with those two immortal tables: Employee & Order Emp
DataSet dataset = new DataSet(PinkElephant); Can anyone give me insight into what PinkElephant means

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.