Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 24th, 2005, 04:06 PM
Registered User
 
Join Date: Jan 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Create new dataset from two existing datasets

Hi,

I'm trying to create a new dataset from two existing datasets. The new dataset (dataset3) should contain the rows from dataset1 where date is in dataset 2.

dataset1:
date price
---- -----
01/01/2005 1.5
02/01/2005 2.5
03/01/2005 3.5

dataset2:
date price
---- -----
01/01/2005 4.5
03/01/2005 5.5

dataset3: (what I want)
date price
---- -----
01/01/2005 1.5
03/01/2005 3.5

Any help would be greatly appreciated!

Thanks,
Wai



 
Old June 27th, 2005, 10:20 AM
Registered User
 
Join Date: Jan 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Problem solved:
1. Use DataTable select method on dataset2 using the date from dataset1
2. If row is found then add row to dataset3 else do nothing

 
Old June 27th, 2005, 02:25 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Just to clarify, are you looking to create 1 dataset from 2 or add a dataset's table to another dataset? Can't you just use the dataset.Table.Add() method? Are you confusing DataSets with DataTables?

-Peter
 
Old June 28th, 2005, 09:33 AM
Registered User
 
Join Date: Jan 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Peter,

Sorry for the confusion! I was attempting to create a new datatable from 2 existing. I used the datatable.Rows.Add() method.

Wai






Similar Threads
Thread Thread Starter Forum Replies Last Post
When To Create Datasets AspNetGuy BOOK: Beginning ASP.NET 2.0 and Databases 2 July 6th, 2008 07:48 AM
Create new row using a typed dataset humour ASP.NET 2.0 Professional 0 May 9th, 2008 09:49 PM
How to create an extra table in a dataset?? soundchaser59 ASP.NET 1.0 and 1.1 Basics 2 July 13th, 2007 10:29 PM
Create a DataSet in a Web Service amirdiwan C# 2005 1 February 22nd, 2007 04:52 PM
Create Control in Existing Form Oleg123 Access 1 July 1st, 2004 01:24 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.