473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

ImportRow doesn't import the data...

Hi,

I am using ImportRow to get selected rows from a DataTable and add them to a
new table. The code looks something like this:

DataTable dtTemp = new DataTable();

foreach(DataRow drOld in dsOld.Tables["Customers"].Rows)
{
foreach(DataRow drExisting in DTNewCustomers.Rows)
{
if(Convert.ToInt32(drOld["HouseNo"]) == Convert.ToInt32
( drExisting[0]))
{
dtTemp.ImportRow(drOld);
}
}
}

dsCustomers.Tables.Add(dtTemp);

When I step through it, drOld has 7 values and this row is added to dtTemp
(I have a breakpoint on the line:

dtTemp.ImportRow(drOld);

and the row count of dtTemp increments by 1).

However, the data is not being copied across. I simply get an empty
Datagrid when binding to the dtTemp table, and the ItemArray property of each
row in dtTemp has a count of 0.

Does anyone know why this would be?
Apr 16 '07 #1
0 3226

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Olivier Noblanc ATOUSOFT | last post by:
Hello, In the botom of this post you will see my source code. The problem is when i launch main.py that doesn't make anything why ? Thanks olivier noblanc Atousoft...
1
by: Michael Van Altena via .NET 247 | last post by:
Why doesn't the following add a row to the table dtTemp1? System.Data.DataTable dtTemp1 = new System.Data.DataTable("Test1"); dtTemp1.Columns.Add("ColumnA",...
0
by: Uchiha Jax | last post by:
I have used this method many a time in previous applications without any hitches at all and i'm trying to use it in my current application and it isn't working. The only difference I can see is...
3
by: Gene Hubert | last post by:
I'm using DataTable.ImportRow to move data from one datatable to another... Dim dt, dtTarget As DataTable Dim dr As DataRow dt = DirectCast(Me.DataSource, DataTable) dtTarget = dt.Clone...
2
by: jaYPee | last post by:
I have tried almost everything I know but still I can't find a way on how to resolve this problem. I'm using ImportRow to copy some record from 1 table to another table. Here are my code that...
1
by: jaYPee | last post by:
I'm wondering how to use the importrow so that the record from other datatable will be imported to other datatable. here's my datatable and dataview Private dtStudents As DataTable Private...
2
by: jaYPee | last post by:
At last I have found the problem why I can't get to work w/ importrow. The fact is that I'm trying to import data to related table. But after importing data the foreign is blank. So thats why the...
1
by: kempshall | last post by:
Hi, I have a question about the .NET DataTable.ImportRow method. If I import a DataRow into an empty DataTable, will the empty DataTable pick up the schema of the DataRow I'm trying to put into...
2
by: Rob Dob | last post by:
Hi, I'm trying to archive orginal records, so what I am trying to do is upon saving the changed record also writing the orginal record version to a different table. The problem I'm having is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.