﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum / StrataFrame Application Framework / Business Objects and Data Access (How do I?)  / Using a Group By statement when filling a data table / Latest Posts</title><generator>InstantForum.NET v4.1.4</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>forum@strataframe.net</webMaster><lastBuildDate>Thu, 21 Aug 2008 16:53:26 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Using a Group By statement when filling a data table</title><link>http://forum.strataframe.net/Topic14891-6-1.aspx</link><description>No problem...I figured it was something along those lines.  Glad you found it :)</description><pubDate>Fri, 14 Mar 2008 14:28:51 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Using a Group By statement when filling a data table</title><link>http://forum.strataframe.net/Topic14891-6-1.aspx</link><description>Ok, you were right...sort of.  Haha.&lt;/P&gt;&lt;P&gt;My SQL was fine, the query worked correctly.  But, I had something in the Navigated event that was using a property that wasn't returned by that query in that specific case.  It confused me because the error wasn't breaking into the event...it was breaking into the FillDataTable method.  Either way, it's fixed now, so thanks for the point in the right direction.</description><pubDate>Fri, 14 Mar 2008 14:22:22 GMT</pubDate><dc:creator>Andria Jensen</dc:creator></item><item><title>RE: Using a Group By statement when filling a data table</title><link>http://forum.strataframe.net/Topic14891-6-1.aspx</link><description>Well, let me tell you this first, double check your query.  If the query works within SQL Server Management Studio query then it will not be affected through the FillDataTable.  I will tell you a little story here...the other day I was getting one value when executing a query within SQL Server Management Studio and another when I called ExecuteScalar on the BO....I would have SWORN there was an issue...I kept looking over my command, debugged the ES Server, even got another pair of eyes to look at my query.  Over an hour later...um...Ben finally saw what was wrong...I left of an @ in front of one of my parameters. :blush:&lt;/P&gt;&lt;P&gt;So it happens to us all...since I do not have your data structures it is hard for me to tell you what is exactly wrong with your query.  But I would double-check what you are doing there.&lt;/P&gt;&lt;P&gt;I am sure that the query that you posted was just to show me some values, but you should definitely be using parameters in your actual query command versus embedded values.</description><pubDate>Fri, 14 Mar 2008 13:06:38 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>Using a Group By statement when filling a data table</title><link>http://forum.strataframe.net/Topic14891-6-1.aspx</link><description>I'm using a sql statement like the following:&lt;/P&gt;&lt;P&gt;&lt;FONT color=#111111&gt;SELECT CheckDtl.AcctNo, Transactions.ClientKey as ClientKey,   &lt;BR&gt;SUM(CASE WHEN CheckDtl.Amt &amp;gt; 0 THEN CheckDtl.Amt END) AS CreditAmt, &lt;BR&gt;SUM(CASE WHEN CheckDtl.Amt &amp;lt; 0 THEN ABS(CheckDtl.Amt) END) AS DebitAmt &lt;BR&gt;FROM CheckDtl  &lt;BR&gt;INNER JOIN CheckHdr ON CheckHdr.CheckHdrKey=CheckDtl.CheckHdrKey  &lt;BR&gt;INNER JOIN Transactions ON Transactions.TransKey=CheckHdr.TransKey  &lt;BR&gt;WHERE CheckHdr.CheckType&amp;lt;&amp;gt;5  AND CheckHdr.CheckDate &amp;gt;= '01-Jul-2006' &lt;BR&gt;  AND CheckHdr.CheckDate &amp;lt;= '31-Jul-2006' &lt;BR&gt;GROUP BY CheckDtl.AcctNo, Transactions.ClientKey&lt;BR&gt;ORDER BY CheckDtl.AcctNo, Transactions.ClientKey&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Now this query returns exactly what I want when run against the database, but when I try to use it in a FillDataTable method I get the following error:&lt;/P&gt;&lt;FONT size=1&gt;&lt;P&gt;System.ArgumentException - Column 'CheckHdrKey' does not belong to table CheckDtl.&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;Now, is it still looking for the primary and foreign keys to be in the query even when I'm not using them?  I can't figure out a way to put them in the query and produce what I want with the grouping the way I have it.  Please give me some input here, or let me know if I'm doing something wrong.  Thanks.&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;</description><pubDate>Fri, 14 Mar 2008 12:28:48 GMT</pubDate><dc:creator>Andria Jensen</dc:creator></item></channel></rss>