473,395 Members | 1,554 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,395 software developers and data experts.

Moving a row between 2 datasets

C#

I have a screen with 2 datagrids on it. The screen is designed for
allocating records from one datagrid to the other. Once a record has moved
from one to the other, i refresh them both to show the change. To do the
refresh though, currently I am sending a request back to the DB to refetch
the records, which can obviously have performance hits.

I have been able to refresh the datagrid which is losing the record, by
creating a new dataset, merging the old data into it, and then removing the
relevant row from this dataset before rebinding the grid to it:

dsData topGridDS = new dsData();

topGridDS.Merge(initialTopDS.Job);

topGridDS.Job.Rows.Remove(topGridDS.Job.FindByJobI D(....))

datagrid1.datasource = topGridDS...
....
...

so this refreshes the datagrid that is losing a row, without going back to
the DB to refresh. But how do I do the reverse process, of adding the moved
row into a new dataset? If I use the AddRow method it complains that the row
already belongs to a dataset. I thought maybe I could use the CopyTo method
but I cant work out how to use that either.

Thanks

Steve
Apr 27 '06 #1
1 1285
Use the ItemArray of the original DataRow to get the data in it, and then
use the same ItemArray to fill a new row in the receiving table.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.

"Steve" <St***@discussions.microsoft.com> wrote in message
news:43**********************************@microsof t.com...
C#

I have a screen with 2 datagrids on it. The screen is designed for
allocating records from one datagrid to the other. Once a record has
moved
from one to the other, i refresh them both to show the change. To do the
refresh though, currently I am sending a request back to the DB to refetch
the records, which can obviously have performance hits.

I have been able to refresh the datagrid which is losing the record, by
creating a new dataset, merging the old data into it, and then removing
the
relevant row from this dataset before rebinding the grid to it:

dsData topGridDS = new dsData();

topGridDS.Merge(initialTopDS.Job);

topGridDS.Job.Rows.Remove(topGridDS.Job.FindByJobI D(....))

datagrid1.datasource = topGridDS...
...
..

so this refreshes the datagrid that is losing a row, without going back to
the DB to refresh. But how do I do the reverse process, of adding the
moved
row into a new dataset? If I use the AddRow method it complains that the
row
already belongs to a dataset. I thought maybe I could use the CopyTo
method
but I cant work out how to use that either.

Thanks

Steve

Apr 27 '06 #2

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

Similar topics

4
by: Alpha | last post by:
I have a small Window application and through out the different forms I create a different dataset. At the begining I used the Tools to drag and drop the SqlDataAdapter, connection and dataset...
9
by: GaryDean | last post by:
We have been noticing that questions on vs.2005/2.0 don't appear to get much in answers so I'm reposting some questions posted by some of the programmers here in our organization that never got...
16
by: Luqman | last post by:
Is it recommended to use datasets in ASP.Net 2.0 / VS.Net 2005 ? Best Regards, Luqman
4
by: Ronald S. Cook | last post by:
I've always used untyped datasets. In a Microsoft course, it walks through creating typed datasets and harps on the benefits. It has you drag all these things around ..wizard, wizard, wizard......
3
by: Don Miller | last post by:
In my migration from ASP to ASP.NET 2.0, I have a fair number of complicated HTML tables that defy anything .NET can do. Using classic ASP I created these tables (by string concatenation) by moving...
25
by: Penelope Dramas | last post by:
Hello, I'm in a front of very serious .net redesign/rewrite of an old VB6 application. I had been asked to make it .NET 2.0 and would like to ask couple of questions regarding data access as...
8
by: Chris Asaipillai | last post by:
Hi there I have some questions for those experienced Visual Basic 6 programmers out there who have made the transition from VB6 to Vb.net. How long did it take you to learn at least the basic...
0
by: S.Tedeschi | last post by:
Hi all; as posted some days ago, I'm converting an on-line app; I used to heavily rely on strongly-typed DataSets directly dropped onto pages, and so viewed by code(-behind) as well. In the next...
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...
9
by: gardnern | last post by:
We have X number of data sets, of Y length each. For example... Small, Medium, Large and Red, Green, Blue, Yellow We need to generate a list of all possibilities Small Red
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
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
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...
0
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,...

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.