Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional 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 July 20th, 2004, 06:33 PM
Registered User
 
Join Date: Jul 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default query of dataset

I have created a dataset with multiple tables including the relationships. I need to query the tables in the dataset to create a table of DISTINCT records that have fields from multiple tables. I would know how to do this with the SQL language, but don't know what functions to use in an existing dataset. A dataview won't work because that only filters a single table. Any iteas?
 
Old July 21st, 2004, 09:29 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

Can you union all of the entire result sets in the SQL query, then use a DataView to filter the result sets? Or, can you do it at the SQL query level? That may be the easiest. To get distinct records from multiple tables, you may have to loop through each table to compare the result sets.

Brian
 
Old July 21st, 2004, 09:59 AM
Registered User
 
Join Date: Jul 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think Bmains is right. if you need any reference on union go to
http://www.w3schools.com/sql/sql_union.asp

and reference on select with all kind of options go to.
http://msdn.microsoft.com/library/de...a-ses_9sfo.asp

I'll did all I could, I am doing all I can and I will do all I can. Now, you better do all you can.
 
Old July 21st, 2004, 10:02 AM
Registered User
 
Join Date: Jul 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

bmains,

Thanks for the reply. I can't union them all, because i'd never get the distinct set that I need. I was hoping that I wouldn't have to do the filtering at the SQL query level, because it will mean several specialized stored proceedures, since I am allowing user driven filtering of the main recordset.

I am trying to use the distinct records to populate two different dropdownlists with only the options available in the main recordset.
 
Old July 21st, 2004, 12:28 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

Well then the only other thing I can think of adding is to select the data from one recordset and use a DataView to query the other recordset. Then if there is any rows returned from the DataView delete them from the datatable, or do something with them, whatever your desired action is.

How's that?

Brian
 
Old July 24th, 2004, 02:15 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

Why you don't use DataRealation object in your dataset..
I think you can declare a DataRealation object then determine your parentcolumn and childcolumn then in your dataset object add your realation object...
here by looping through all the rows of your parent column and retriving them (through GetChildRows("youRealation"))you would have an array that includes your child rows then again you can loop in this array for obtaining your rows corresponding the parent column....
Hope this can help you...

--------------------------------------------
Mehdi
I'm waiting for your better idea.
 
Old July 24th, 2004, 05:57 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 336
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alyeng2000
Default

i was already need to do some thing like that
my problem was to query many tables and i got 2 tables and i cached them and i was need to query them again in .net but failed to easy deal as i write queries so i finaly do that using loops


Ahmed Ali
Software Developer
 
Old July 28th, 2004, 08:28 AM
Registered User
 
Join Date: Jul 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Look at this link, it got a sample
http://support.microsoft.com/default...b;EN-US;326176






Similar Threads
Thread Thread Starter Forum Replies Last Post
dataset and sql query notification p2pMember ASP.NET 2.0 Professional 1 September 26th, 2007 07:22 PM
How can i use typed dataset with Join Sql query? vijaykumartaduri BOOK: Professional Crystal Reports for VS.NET 0 November 10th, 2005 04:02 AM
accesing data using dataset and multiple query Bhavin Crystal Reports 0 August 24th, 2004 11:09 AM
Re: SQL Server dataset to ACCESS dataset dazzer ADO.NET 0 March 22nd, 2004 05:28 AM
Returning Oracle SELECT query results to DataSet gp_mk ADO.NET 0 December 17th, 2003 11:08 AM





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