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

get new dataset from common records of 2 sets

there r 2 datasets and I want to get 3rd dataset containing the records which are common in 1st and 2nd datasets. common field in dataset 1 n 2 is id. what is the best method to do it?
Jun 19 '08 #1
5 949
Curtis Rutland
3,256 Expert 2GB
I would loop through dataset1, and for each record loop through dataset2, adding the row only when it is in common.

Not very efficient (n^2) but the only way I know how.
Jun 19 '08 #2
Plater
7,872 Expert 4TB
If both Tables are in a single DataSet object, you might be able to do something with a DataAdapter? I'm not sure as I've never tried.
Jun 19 '08 #3
If both Tables are in a single DataSet object, you might be able to do something with a DataAdapter? I'm not sure as I've never tried.
plater,
there r 2 datasets, not 2 tables.
Jun 19 '08 #4
I would loop through dataset1, and for each record loop through dataset2, adding the row only when it is in common.

Not very efficient (n^2) but the only way I know how.
i thought the same way, loop through both datasets, but when i try to add common records in new dataset, it throws error, can you tell me by example?
Jun 19 '08 #5
Curtis Rutland
3,256 Expert 2GB
i thought the same way, loop through both datasets, but when i try to add common records in new dataset, it throws error, can you tell me by example?
You need to use .ImportRow(dataRow)

Example
Expand|Select|Wrap|Line Numbers
  1. //c#
  2. DataTable2.ImportRow(DataTable1.Rows[0]);
  3.  
That would copy row 0 from DataTable1 to DataTable2. That should be enough to get you started.
Jun 20 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Jan van Veldhuizen | last post by:
The UPDATE table FROM syntax is not supported by Oracle. I am looking for a syntax that is understood by both Oracle and SqlServer. Example: Table1: id name city ...
1
by: william | last post by:
Hi, I was using Typed Dataset in VB.NET to generate XML file. I difined XSD file( named customer_order_info) to include three tables, let's say customers, orders and order_details. I also defined...
5
by: Grant | last post by:
Hello, How come when I add a new row to my dataset table it shows up as changed (agencyData.Haschanges() = True) but when I delete a row the dataset thinks here are no...
1
by: Jeroen Pot | last post by:
Hi, I have a dataset "Mydataset" which contains of a few fields. (lets say dept_id and dept_name) A user can select several of these, and i want to export this to an access database. I have...
4
by: Bas Hamer | last post by:
I guess I don't know how to word it better than that. Our company has machines that generate log file in our own proprietary language. A while back I wrote a class that took one of these files...
2
by: David Richards | last post by:
Hi, I was wondering if anyone could help me. I have DataSet that contains the following data tables Customers, Calls, Quotes, QuoteDetails, Competitors, Contacts, Notes, and I have setup...
4
by: Al | last post by:
I have this scenario: 1. XML file with schema and data is created from SQL Server tables. XML file contains 6 tables, some of them have rows, some of them are empty. 2. XML file is given to the...
6
by: Joe Kovac | last post by:
Hi! I change quite a lot TableRows in several Tables of a typed DataSet. Now I would like to know which is the best way to save all the rows. Currently I just use each TableAdapters Update()...
3
by: Ken Fine | last post by:
This is a question that someone familiar with ASP.NET and ADO.NET DataSets and DataTables should be able to answer fairly easily. The basic question is how I can efficiently match data from one...
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...
1
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: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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.