Joining two Datasets
Joining two Datasets
Joining two Datasets
Joining two Datasets
Joining two Datasets
Joining two Datasets Joining two Datasets Joining two Datasets Joining two Datasets Joining two Datasets Joining two Datasets Joining two Datasets Joining two Datasets
Joining two Datasets Joining two Datasets
Joining two Datasets
Go Back  Xtreme Visual Basic Talk > > > Joining two Datasets


Reply
 
Thread Tools Display Modes
  #1  
Old 08-28-2014, 04:09 AM
Bashirahmad Bashirahmad is offline
Newcomer
 
Join Date: Feb 2013
Location: kashmir
Posts: 15
Default Joining two Datasets


Consider two tables orders and order detail

orders table has fields as orderid, date,... and orderdetail has fields as orderid,item,cost,....

Table orders has orderid as primarykey and a foreign key in orderdetail.

having filled two datasets as dsorders and dsorderdetails in the frontend and filling orderdetails with some entries, how to generate sql statement which connects two datasets and retreives related records?
The sql statement is straightforward if the data is obtained directly from the database tables, but since the current dsorderdetails is simply a local copy, amethod of connecting it dsorders is requested.
thanks for advance.


Bashir ahmad
Reply With Quote
  #2  
Old 08-28-2014, 04:44 AM
PlausiblyDamp's Avatar
PlausiblyDampJoining two Datasets PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

You could load both tables into the same DataSet as two individual DataTables, that way you could define a relationship between them to aid in this kind of thing.

If you use the build in DataSet designer then you can create this simply by dragging the relevant tables from the database into the designer and it will build the relationships for you.

Alternatively you can also use LINQ over a DataSet which can give you an alternate way of joining two DataTables together, then again if you are considering LINQ then you might just want to look at Linq2Sql or the Entity Framework as an alternative to DataSets anyway.
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
  #3  
Old 08-29-2014, 12:38 AM
Bashirahmad Bashirahmad is offline
Newcomer
 
Join Date: Feb 2013
Location: kashmir
Posts: 15
Default

Thanks for ur kind response


Bashir ahmad
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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 Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Joining two Datasets
Joining two Datasets
Joining two Datasets Joining two Datasets
Joining two Datasets
Joining two Datasets
Joining two Datasets Joining two Datasets Joining two Datasets Joining two Datasets Joining two Datasets Joining two Datasets Joining two Datasets
Joining two Datasets
Joining two Datasets
 
Joining two Datasets
Joining two Datasets
 
-->