473,405 Members | 2,310 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,405 software developers and data experts.

Why doesn't ImportRow() work?

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", System.Type.GetType("System.String"));
dtTemp1.Columns.Add("ColumnB", System.Type.GetType("System.Decimal"));

System.Data.DataRow oRow = dtTemp1.NewRow();
oRow["ColumnA"] = "Test";
oRow["ColumnB"] = 0.25M;

dtTemp1.ImportRow(oRow); // This is the line that seems to do nothing, and throws no exceptions...
--------------------------------
From: Michael Van Altena

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>gvph7W/8y06kyVTCmgSETw==</Id>
Nov 16 '05 #1
1 5173
psg

"Michael Van Altena via .NET 247" <an*******@dotnet247.com> wrote in message
news:e4**************@TK2MSFTNGP12.phx.gbl...
dtTemp1.ImportRow(oRow); // This is the line that seems to do nothing,
and throws no exceptions...


Why don't you use:
dtTemp1.Rows.Add(oRow);

I think that
dtTemp1.ImportRow(oRow);
has more to do with:
dtTemp1.NewRow();
or "copying" see MSDN.

Try to test two lines:
dtTemp1.Rows.Add(oRow);
dtTemp1.ImportRow(oRow);

RGDS PSG
Nov 16 '05 #2

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

Similar topics

149
by: Christopher Benson-Manica | last post by:
(Followups set to comp.std.c. Apologies if the crosspost is unwelcome.) strchr() is to strrchr() as strstr() is to strrstr(), but strrstr() isn't part of the standard. Why not? --...
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...
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: =?Utf-8?B?Y2FzaGRlc2ttYWM=?= | last post by:
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...
39
by: alex | last post by:
I've converted a latin1 database I have to utf8. The process has been: # mysqldump -u root -p --default-character-set=latin1 -c --insert-ignore --skip-set-charset mydb mydb.sql # iconv -f...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.