473,394 Members | 1,797 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,394 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 5171
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: 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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: 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
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.