473,668 Members | 2,446 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What's the most efficent way to create a dataset table from a join

Hi, I'm using vs2005 and .net 2.0
I used 2 DirectorySearch ers to retrieve data from Active Directory and
placed them in 2 dataset tables. I need to perform the SQL equuvakebt of
join operation to create a 3rd dataset table that I will then pass to Crystal
Report.
1. Sometimes there could be 100,000 records or more per table. Is this the
most time efficient way to do it?
2. I tried using the datarelation and looping through each datarow but I'm
getting run time error something like" there is no matching value for each
parent value....". I want to retrieve the "join" records so there would be
times that a record is in one table but not the other but it's giving me
error so what should I do now to retrived the join records?
3. I didn't define primary key for either tables. Do I need to do that
first to address the error?
4. My datarelation code:
dsReport.Relati ons.Add("relati onComputers",
dsReport.Tables["PadCompute rs"].Columns["cn"],
dsReport.Tables["AdComputer s"].Columns["objectSid"]);

--
Thanks.
Jan 26 '07 #1
2 1751
If the child table has rows not related to the parent table, then I do
not think you will be able to use DataRelations to manage this task.

You could brute force it by sorting both DataTables on the 'matched'
columns. Then you could iterate through the Rows collections of
DataTables in a common loop adding the new rows to your 3rd DataTable.
Since the original 2 tables are sorted, it would be straight-forward to
know when there are matching rows in the original DataTables to allow
you to add a new joined row to the 3rd DataTable in this case and also
to recognize when you have to add a row based only on one of the
original DataTables.

=============== =
Clay Burch
Syncfusion, Inc.

Jan 26 '07 #2
Do I have to create a dataview for each of the datatable to do a sort on each
of the table? I don't think datatable has sort method. Or should I do
Select statement with sort?
--
Thanks.
"ClayB" wrote:
If the child table has rows not related to the parent table, then I do
not think you will be able to use DataRelations to manage this task.

You could brute force it by sorting both DataTables on the 'matched'
columns. Then you could iterate through the Rows collections of
DataTables in a common loop adding the new rows to your 3rd DataTable.
Since the original 2 tables are sorted, it would be straight-forward to
know when there are matching rows in the original DataTables to allow
you to add a new joined row to the 3rd DataTable in this case and also
to recognize when you have to add a row based only on one of the
original DataTables.

=============== =
Clay Burch
Syncfusion, Inc.

Jan 26 '07 #3

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

Similar topics

2
2517
by: serge | last post by:
/* This is a long post. You can paste the whole message in the SQL Query Analyzer. I have a scenario where there are records with values pointing to wrong records and I need to fix them using an Update statement. I have a sample code to reproduce my problem. To simplify the scenario I am trying to use Order related tables to explain a little better the tables i have to work with.
4
9160
by: Fred | last post by:
Hi. What is the usual and what are the possible fields to use for the primary key of an intersecting table of a many-to-many relationship? I would think the typical, most common fields would be to set the intersecting table to have its own unique primary key. Right? OR
2
6034
by: Paul Oliveira | last post by:
Bear with me, please... :) TableA on Database1: CodCli -- Name -- Age -- SalesCod (...) (...) (...) (...) TableB on Database2: Key -- CodCli -- Date -- Value (...) (...) (...) (...)
6
5063
by: Alpha | last post by:
I retrieve a table with only 2 columns. One is a auto-generated primary key column and the 2nd is a string. When I add a new row to the dataset to be updated back to the database. What should I do with the 1st column ? (Below I have a "1" in place for now). Also, Does the datase.AcceptChanges(); updates the changes to the database? Which command do I use to update the changes in dataset back to the Access database table? Thanks, Alpha...
3
2047
by: Ben Becker | last post by:
I am trying to build a custom crosstab type of grid where I take some items in a data grid and based on the content of the current item compared to the previous item, determine if a new row in a table should be created or not. In order to do this, I need to have full control over the conditional logic for how items get displayed within a repeater element which I'm not seeing as possible. How can I cursor through a data set, apply...
8
1427
by: cjobes | last post by:
Hi all, The code below is part of a form where I would like the user to make selections from a table. The data is brought into the form from another form with: Public WriteOnly Property DataSet() As DataSet Set(ByVal Value As DataSet) ResultGrid.DataSource = Value.Tables("tbSelect") End Set End Property
3
7095
by: Dragon | last post by:
Can I Join two Data Table in Data set ?? Is it using the DataSet.Merge ? Any example ?
39
3211
by: windandwaves | last post by:
Hi Folk I have to store up to eight boolean bits of information about an item in my database. e.g. with restaurant drive-through facility yellow windows
0
1298
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Hi, I'm using vs2005 and .net 2.0. I have used 2 DirectorySearchers to retrieve Active Directory data and put them into 2 separate dataset tables. I want to create a 3rd dataset table by using the equivalent of SQL join operation. This 3rd table will then be passed into Crystal Report. 1. Sometimes each table could contain 100,000 records or more. Is this the most efficeint way to do this? 2. Since there is no join query for dataset...
0
8889
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8790
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8652
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7391
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5677
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4202
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2782
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2017
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.