473,503 Members | 11,435 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

adding datarows to tables and datatables to datasets

psb
I thought this was weird?? is this a bug in framework 1.0??? (1.0 is the
version I am running against)

---------------------------
dim dtAll as new datatable
dim dtTmp as datatable
dtTmp = LoadDataTable("select top 100 from table...")
for i=0 to dtTmp.rows.count -1
''''ERROR ON THIS LINE'''
dtAll.Rows.Add(dtTmp.rows(i))
next
-------------------------------
ERROR: Datarow already belongs to another datatable

I get the same error with adding datatables to datasets althought it says
"this table belongs to another dataset"
---------------------------------------
dim MyDataSet as New Dataset
dim dtTmp as datatable
dtTmp = LoadDataTable("select top 100 from table...")
MyDataSet.Tables.Add(dtTmp)
--------------------------------------------

Thanks,
~psb
Nov 18 '05 #1
1 1566
This is not an error. A DataRow may only belong to one DataTable at a time.
The same with a DataTable. A DataTable may only belong to one DataSet at a
time.

-Cliff

"psb" <pb******@msn.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I thought this was weird?? is this a bug in framework 1.0??? (1.0 is the
version I am running against)

---------------------------
dim dtAll as new datatable
dim dtTmp as datatable
dtTmp = LoadDataTable("select top 100 from table...")
for i=0 to dtTmp.rows.count -1
''''ERROR ON THIS LINE'''
dtAll.Rows.Add(dtTmp.rows(i))
next
-------------------------------
ERROR: Datarow already belongs to another datatable

I get the same error with adding datatables to datasets althought it says
"this table belongs to another dataset"
---------------------------------------
dim MyDataSet as New Dataset
dim dtTmp as datatable
dtTmp = LoadDataTable("select top 100 from table...")
MyDataSet.Tables.Add(dtTmp)
--------------------------------------------

Thanks,
~psb

Nov 18 '05 #2

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

Similar topics

0
5839
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...
1
346
by: psb | last post by:
I thought this was weird?? is this a bug in framework 1.0??? (1.0 is the version I am running against) --------------------------- dim dtAll as new datatable dim dtTmp as datatable dtTmp =...
3
2682
by: Yul | last post by:
Hi, We are in the process of designing an ASP.NET app, where a user will enter some 'Customer ID' to be queried in the database. If the ID is valid, several stored procedures will be called to...
16
2453
by: Geoff Jones | last post by:
Hi Can anybody help me with the following, hopefully simple, question? I have a table which I've connected to a dataset. I wish to add a new column to the beginning of the table and to fill...
9
2050
by: Brad | last post by:
I have written some code to manipulate data/records in a MASTER (order header) and DETAIL (order details) tables. What I have written is too extensive to post but essentially trying to: 1....
5
1243
by: Richard Fagen | last post by:
Hi Everyone, I have been writing xBase applications for many years but I am new to VB/SQL for larger applications. In xBase, I would start the main program (form) by opening up all the...
5
1293
by: M Harris | last post by:
We are developing an application (using .Net in MS Studio 2003 using the Access jet engine as a backend) that is doing quite a bit of number crunching. The first part of the application was...
3
11447
by: creator_bob | last post by:
How do I create an array of datarows from a sorted list? I put a bunch of datarows into a sorted list to sort them. Then I got an array of the sorted elements. However, I cannot typecast them. ...
8
2009
by: jehugaleahsa | last post by:
Hello: We wrote an entire application where we add our DataRows to our DataTables immediately. However, we have to shut off our constraints to do this. We would like to use detached DataRows to...
0
7193
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
7264
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,...
1
6975
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
5562
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,...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1495
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
728
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
371
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.