Lost Password?

Go Back   CodeCall Programming Forum > Software Development > C# Programming

C# Programming C# (pronounced C-sharp) is a new object oriented language from Microsoft and is derived from C and C++. It also borrows a lot of concepts from Java too including garbage collection.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-24-2008, 08:38 PM
jaden403 jaden403 is offline
Newbie
 
Join Date: Apr 2008
Posts: 2
Rep Power: 0
jaden403 is on a distinguished road
Default Merging datasets based upon primary key

I have two datasets with nothing in common except for the values in the first column of each (and the columns are named differently) that I am trying to merge and use in a DataGrid.

ds1 looks like:

Col1 Col2 Col3

100 Red Blue

200 Pink Yellow

ds2 looks like:

Column1 Column2 Column3 Column4 Column5 Column6

100 Wood Fire Rain Rocks Flowers

200 Grass Glass Trees People Things

What I am trying to accomplish is this:


100 Red Blue Wood Fire Rain Rocks Flowers
200 Pink Yellow Grass Glass Trees People Things

I know what to do, just not how to do it: that is, loop through each row of ds1. If the value of the first column of ds1 is equal to the value of the first column of ds2, add ds2 to that row in ds1. I have tried many things, but cannot get this to work correctly.

What am I missing?

Thanks!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 04-25-2008, 11:15 AM
Xav's Avatar   
Xav Xav is offline
Guru
 
Join Date: Mar 2008
Location: London, England
Posts: 3,019
Last Blog:
Piano Exam
Rep Power: 26
Xav is a name known to allXav is a name known to allXav is a name known to allXav is a name known to allXav is a name known to allXav is a name known to all
Send a message via MSN to Xav
Default Re: Merging datasets based upon primary key

Just try a loop?
__________________
Xav, the power of youth
Worship the Creator... not his creations
Web Site | Beta Site
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-25-2008, 07:15 PM
jaden403 jaden403 is offline
Newbie
 
Join Date: Apr 2008
Posts: 2
Rep Power: 0
jaden403 is on a distinguished road
Default Re: Merging datasets based upon primary key

That's what I had to end up doing.

loop through ds1 rows
loop through ds2 rows
loop through ds1 columns
loop through ds2 columns
look for matching values
copy columns from ds2 in ds1

I just thought there would be an easier way to do that than using nested loops.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-27-2008, 01:35 PM
Xav's Avatar   
Xav Xav is offline
Guru
 
Join Date: Mar 2008
Location: London, England
Posts: 3,019
Last Blog:
Piano Exam
Rep Power: 26
Xav is a name known to allXav is a name known to allXav is a name known to allXav is a name known to allXav is a name known to allXav is a name known to all
Send a message via MSN to Xav
Default Re: Merging datasets based upon primary key

Well, if it works, then there shouldn't be too much of a problem. Just make sure that you use the Application.DoEvents() command - that way, it won't jam up the rest of program whilst the program is looping through the hundreds of rows...

It might make it a tad slower, but it's probably worth it to stop the rest of the program freezing. Maybe you could implement a check box labelled "Keep User Responsive" - if it's checked, then use DoEvents(), and if not - well, it's their fault if their computer gums up.
__________________
Xav, the power of youth
Worship the Creator... not his creations
Web Site | Beta Site
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Web Based IDE drussoPD Website Design 5 07-24-2007 03:02 PM
Asp.net and datasets reachpradeep ASP, ASP.NET and Coldfusion 0 03-05-2007 08:01 AM


All times are GMT -5. The time now is 11:34 PM.

Contest Stats

dargueta ........ 93.00000
John ........ 87.50000
Xav ........ 50.00000
MeTh0Dz ........ 20.00000
gaylo565 ........ 18.00000
Johnnyboy ........ 3.00000

Contest Rules

Ads