﻿<?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 - V1 » Business Objects and Data Access (How do I?)  » Building SQL Dynamic WHERE Condition???</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Thu, 09 Apr 2026 12:33:55 GMT</lastBuildDate><ttl>20</ttl><item><title>Building SQL Dynamic WHERE Condition???</title><link>http://forum.strataframe.net/FindPost33258.aspx</link><description>Hi all,&lt;br/&gt;I normally will build a MS-SQL Stored Procedure to get the data from all my reports, but in this case, I am working on a project that would have a gazillion filter conditions.&amp;nbsp; We are re-writing an application from a Visual FoxPro and the way this was handle was by using the old good VFP macro expansion technique by testing each conditions in the query or filter form and building the "WHERE - filter" string.&lt;br/&gt;&lt;br/&gt;I can easily replicate that kind of logic using and SqlCommand object, but was wondering if there was a much better way to build this dynamic query?&amp;nbsp; I have not looking at the Browser Dialog source but I would imagine it uses a more generic object oriented approach to build the query and grab the data.&lt;br/&gt;&lt;br/&gt;As always any suggestion is greatly appreciated.&lt;br/&gt;&lt;br/&gt;Thanks!!!</description><pubDate>Mon, 18 Jan 2016 08:45:57 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Building SQL Dynamic WHERE Condition???</title><link>http://forum.strataframe.net/FindPost33260.aspx</link><description>Hi Edhy.&lt;br/&gt;&lt;br/&gt;Remember the BrowseDialog ended up having only an AND possibility between all arguments, guess it is a price for the generic approach. &lt;br/&gt;In the beginning, I tried to build something generic too, but after a while gave it up, maybe too soon, and now for each XYZ report, I will have at least an XYZReportCriteria form, an XYZDataSource class file, an XYZBBS business binding source and an XYZLayout.xml.&lt;br/&gt;&lt;br/&gt;The ReportCriteria form will call a Populate method in the DataSource class, which will check all conditions from the arguments passed and build the Command to query the database, returning back the business binding source populated so the form can then use a ReportViewer using the .xml layout set for it.&lt;br/&gt;&lt;br/&gt;Attached&amp;nbsp;is a picture of a basic sample. Some reports, of course, will involve lots of BOs.&lt;br/&gt;&lt;br/&gt;Abraços.&lt;br/&gt;&lt;br/&gt;Ivan</description><pubDate>Mon, 18 Jan 2016 08:45:57 GMT</pubDate><dc:creator>Ivan George Borges</dc:creator></item></channel></rss>