473,324 Members | 2,193 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,324 software developers and data experts.

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 1361

I wouldn't clone.

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

mydataset dsPotentiallyGoodDS = new mydataset();
mydataset dsBadData = new mydataset();
Loop over dsAllData

when an error occurs then do this

for each alldatarow in dsAllData.Select("");

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

dsBadData.mytable.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**********************************@microsof t.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 dsPotentiallyGoodDS = new mydataset();
mydataset dsBadData = new mydataset();
Loop over dsAllData

when an error occurs then do this

for each alldatarow in dsAllData.Select("");

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

dsBadData.mytable.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**********************************@microsof t.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
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...
1
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...
12
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...
1
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.