473,654 Members | 3,253 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.coun t -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.Table s.Add(dtTmp)
--------------------------------------------

Thanks,
~psb
Nov 18 '05 #1
1 1578
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.c om> wrote in message
news:%2******** ********@tk2msf tngp13.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.coun t -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.Table s.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
5850
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 that I am using a strongly typed dataset (and hence datatables and datarows), does that make this function not work? I figured as my TaskRow inherited from DataRow that there shouldn't be a problem. The code, put simply is as follows:
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 = LoadDataTable("select top 100 from table...") for i=0 to dtTmp.rows.count -1 ''''ERROR ON THIS LINE''' dtAll.Rows.Add(dtTmp.rows(i))
3
2689
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 populate multiple webpages containing customer information. There isn't a one-to-one correlation between the stored procedure and a webpage. In other words, a webpage may have to refer to 1 or more DataTables to populate itself. Therefore, a...
16
2473
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 it with incremental values e.g. if the tables looks like this: 23 56
9
2057
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. Assign to a datarow (dr1) the first record of the MASTER table 2. Assign to another datarow (dr2) the second record of the MASTER table 3. If dr1.field1 = dr2.field1, then proceed, otherwise do stop 4. Assign to a third datarow (dr3) the first record...
5
1250
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 datafiles (dbf) and indexes (cdx) that I would need to reference throughout the application. I would also keep these files open throughout the application.
5
1298
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 written using collections, but we have now found that manipulating the data in virtual tables (datasets) seems a better way to go. However, we have not attempted to rewrite the previous code to compare the processing of one compared to the other. Has...
3
11493
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. I get an invalid cast error. I notice that in the debugger, that arrays of datarows are listed as {Length=xx}, but my arrays are listed as {system.array} and refuse to typecast. Public Class mySortedList Inherits SortedList
8
2013
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 circumvent this. What do you normally do to track detached DataRows? Is there a way to retrieve them? or do I have to stored them in some temporary location? Thanks for any input!
0
8379
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8816
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8709
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8596
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7309
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4297
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2719
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 we have to send another system
2
1597
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.