473,654 Members | 3,251 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 1577
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
8290
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8815
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
8708
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...
1
8489
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7307
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
6161
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
5622
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4149
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.