473,671 Members | 2,550 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Datasets - Cloning problems

P K
Hi,

I have 3 datasets
d1Main is the main dataset having rows.
I loop through rows in d1main and any row failing validations is moved to
d2Bad dataset. I had to clone d2bad as d1main and then add failed row to
d2bad

so d2bad is created out of d1main.

Now comes d3good. any records valid in d1main are moved to d3good. again
this was done by cloning d1main for d3good.

Now i use d3good to update the database. The moment database error occurs. I
have to move row in d3good to d2bad.

Moving is failing as it says row already exists. Already d3good is cloned
out of d1main. I cannot clone it again out of d2bad.

how do I do this??


Mar 31 '06 #1
3 1371

I wouldn't clone.

I'd do this
mydataset dsAllData = new mydataset();

mydataset dsPotentiallyGo odDS = new mydataset();
mydataset dsBadData = new mydataset();
Loop over dsAllData

when an error occurs then do this

for each alldatarow in dsAllData.Selec t("");

mydataset.mytab le.myrow badrow = dsBadData.mytab le.Newmyrow();
badrow.a = alldatarow.a;
//continue on all properties

dsBadData.mytab le.Addmyrow( badrow );

next alldatarow

something like that.. the syntax will be wrong.

The key is..... add a NEW row to the bad dataset or potentiallGood dataset
as you encounter them.
...


"P K" <PK@discussions .microsoft.com> wrote in message
news:19******** *************** ***********@mic rosoft.com...
Hi,

I have 3 datasets
d1Main is the main dataset having rows.
I loop through rows in d1main and any row failing validations is moved to
d2Bad dataset. I had to clone d2bad as d1main and then add failed row to
d2bad

so d2bad is created out of d1main.

Now comes d3good. any records valid in d1main are moved to d3good. again
this was done by cloning d1main for d3good.

Now i use d3good to update the database. The moment database error occurs. I have to move row in d3good to d2bad.

Moving is failing as it says row already exists. Already d3good is cloned
out of d1main. I cannot clone it again out of d2bad.

how do I do this??

Mar 31 '06 #2
P K
I wanted to avoid setting value of each column.
And so had to clone and Import.
Columns are not defined. The main dataset could have different kind of data.
Not the same columns always.

To be more precise, I load the dataset from client files. Processing is same
for different files. But the columns in the files could be different.
"sloan" wrote:

I wouldn't clone.

I'd do this
mydataset dsAllData = new mydataset();

mydataset dsPotentiallyGo odDS = new mydataset();
mydataset dsBadData = new mydataset();
Loop over dsAllData

when an error occurs then do this

for each alldatarow in dsAllData.Selec t("");

mydataset.mytab le.myrow badrow = dsBadData.mytab le.Newmyrow();
badrow.a = alldatarow.a;
//continue on all properties

dsBadData.mytab le.Addmyrow( badrow );

next alldatarow

something like that.. the syntax will be wrong.

The key is..... add a NEW row to the bad dataset or potentiallGood dataset
as you encounter them.
...


"P K" <PK@discussions .microsoft.com> wrote in message
news:19******** *************** ***********@mic rosoft.com...
Hi,

I have 3 datasets
d1Main is the main dataset having rows.
I loop through rows in d1main and any row failing validations is moved to
d2Bad dataset. I had to clone d2bad as d1main and then add failed row to
d2bad

so d2bad is created out of d1main.

Now comes d3good. any records valid in d1main are moved to d3good. again
this was done by cloning d1main for d3good.

Now i use d3good to update the database. The moment database error occurs.

I
have to move row in d3good to d2bad.

Moving is failing as it says row already exists. Already d3good is cloned
out of d1main. I cannot clone it again out of d2bad.

how do I do this??


Mar 31 '06 #3
Don't do that. Use T-SQL in a stored proc for everything. Load the
client files to a temp table, and process on the server.

Mar 31 '06 #4

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

Similar topics

3
8746
by: raylopez99 | last post by:
The "C# Cookbook" (O'Reilly / Jay Hilyard), section 3.26, is on deep cloning versus shallow cloning. The scanned pages of this book are found here: http://www.sendspace.com/file/mjyocg (Word format, 3 pp) My question, coming from a C++ background where deep copying is done, is why in C# you would do either deep or shallow copying as suggested by O'Reilly (using the "ICloneable" inhereited interface), at least for the .NET framework. ...
1
1777
by: Dan Dorey | last post by:
I've implemented the ICloneable interface on one of my class. I've written this simple code in two different ways and I think both should work but it's not the case and I'm curious to understand why. The working method: CallflowBase ret = null; ret = this.MemberwiseClone() as CallflowBase; ret.m_callflowName = this.m_callflowName;
12
3582
by: BillE | last post by:
I'm trying to decide if it is better to use typed datasets or business objects, so I would appreciate any thoughts from someone with more experience. When I use a business object to populate a gridview, for example, I loop through a datareader, populating an array list with instances of a custom class in the middle tier, and then send the array list up to the presentation layer and bind the gridview to it. If I use a typed dataset, I...
1
1779
by: Mark Baldwin | last post by:
Steven Thanks for your reply, however the typed datasets are defined in the web service and there seems to way to open the partial class code window - double clicking on the design surface does nothing. I can do this in the client for a client specific dataset, but not in the web service. -- Best regards Mark Baldwin
0
8483
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
8402
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
8927
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
8825
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
8676
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
7445
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...
0
4227
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...
1
2819
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
2062
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.