Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio
This is the forum to discuss the Wrox book ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solution by Vincent Varallo; ISBN: 9780470396865
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio 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
  #11 (permalink)  
Old November 11th, 2009, 12:33 PM
Authorized User
 
Join Date: Mar 2009
Posts: 79
Thanks: 4
Thanked 4 Times in 4 Posts
Default

Vince,

Thanks for the reply. I was able to capture the error and it ispointing to the Select Distinct not having a Group By.

Error:
Code:
{"Column 'AEHospital.REGION' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause."}
Where would the Group By portion go?
  #12 (permalink)  
Old November 11th, 2009, 12:39 PM
Authorized User
 
Join Date: Mar 2009
Posts: 79
Thanks: 4
Thanked 4 Times in 4 Posts
Default

Vince,

I was able to correct this. I just added the Group By at the end of the FromClause method and it worked perfectly.

Thanks for taking the time to help me track this down.
  #13 (permalink)  
Old November 11th, 2009, 01:51 PM
Authorized User
 
Join Date: Mar 2009
Posts: 79
Thanks: 4
Thanked 4 Times in 4 Posts
Default

One last favor Vince and I should be good to go.
Is there a way to see how the Query String is put together prior to being passed?

I have one Query Parameter and if I select it and add it for the report I am catching this error.

Code:
{"Incorrect syntax near the keyword 'WHERE'."}
I would like to see what the combined SQL query looks like. Is it possible to do that?

The whereClause being passed contains this string

Code:
" WHERE convert(varchar, AETransfer.RequestDate, 101) = '10/09/2009'"
  #14 (permalink)  
Old November 11th, 2009, 01:56 PM
Wrox Author
 
Join Date: Jan 2009
Posts: 73
Thanks: 0
Thanked 7 Times in 7 Posts
Default

The Where has to go before the Group By Clause.
  #15 (permalink)  
Old November 11th, 2009, 02:02 PM
Authorized User
 
Join Date: Mar 2009
Posts: 79
Thanks: 4
Thanked 4 Times in 4 Posts
Default

Ok right, this goes back to where should the Group By be placed then.
Doesnt seem like the Framework handles this. I will extend the ENTBaseQuery and see if I can get it to work.

I take it this should follow the pattern of the Select and From Methods.

Thanks
  #16 (permalink)  
Old November 11th, 2009, 02:07 PM
Wrox Author
 
Join Date: Jan 2009
Posts: 73
Thanks: 0
Thanked 7 Times in 7 Posts
Default

Yes, you could take this approach.You could add a GroupBy virtual method in the base class and then override it in your class. The Select method would also need to append the GroupBy clause after the where clause.
  #17 (permalink)  
Old November 11th, 2009, 04:17 PM
Authorized User
 
Join Date: Mar 2009
Posts: 79
Thanks: 4
Thanked 4 Times in 4 Posts
Default

Thanks again Vince.

For anyone that ever needs this, I added this functionality to the Framework as it may be needed again.
Below you can find what I did to get this working.

ENTBaseQueryData
Added abstract method GroupByClause
Changed Run method to include GroupByClause
Code:

return db.ExecuteQuery<T>(SelectClause() + FromClause() + whereClause + GroupByClause(), newObject[] { }).ToList();
Implement the GroupByClause in your QueryData class and it should work.




Similar Threads
Thread Thread Starter Forum Replies Last Post
course builder youyou_hym Dreamweaver (all versions) 1 May 28th, 2008 03:09 AM
sql query builder windw size problem the_dude ASP.NET 2.0 Basics 0 January 25th, 2007 01:37 PM
Looking for a SQL Query Builder for ASP.Net/Oracle rashid_masud SQL Language 0 March 9th, 2006 06:37 AM
Query Builder Help Dwizz Access 1 April 25th, 2005 05:11 AM
how to launch Query Builder tz478 BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 0 March 29th, 2005 10:54 AM





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