<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Data Connections</title><link>https://www.infopathdev.com:443/forums/44.aspx</link><description> </description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Limit number of rows returned from data connection?</title><link>https://www.infopathdev.com:443/forums/thread/36566.aspx</link><pubDate>Mon, 05 Jan 2009 12:24:29 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:36566</guid><dc:creator>geoffc</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/36566.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=36566</wfw:commentRss><description>&lt;p&gt;Jimmy, I just changed the code and everything is now working the way I want. Thank you once again for your excellent assistance. &lt;/p&gt;</description></item><item><title>Re: Limit number of rows returned from data connection?</title><link>https://www.infopathdev.com:443/forums/thread/36490.aspx</link><pubDate>Thu, 01 Jan 2009 16:45:51 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:36490</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/36490.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=36490</wfw:commentRss><description>&lt;p&gt;I think I&amp;#39;ve resolved this issue over private message with Geoffrey.&amp;nbsp; The issue was that results were coming back from the database, but the code to copy them to the main data source wasn&amp;#39;t finding them.&amp;nbsp; It looks like this line was the problem:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;font color="#0000ff"&gt;foreach&lt;/font&gt;&lt;font size="2"&gt; (&lt;/font&gt;&lt;font color="#008080" size="2"&gt;XPathNavigator&lt;/font&gt;&lt;font size="2"&gt; resultsRow1 &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;in&lt;/font&gt;&lt;font size="2"&gt; queryDataFields.SelectChildren(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;TABLE&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;, dNamespace))&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&amp;nbsp;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Oddly enough, if you query an SQL&amp;nbsp;view from InfoPath, the nodes of the result set will have the name of the view, but if you use &amp;quot;TOP &lt;em&gt;X&lt;/em&gt;&amp;quot; in the query, the nodes are named after one of the tables in the view.&amp;nbsp; Changing that line to the following should work for just about any situation:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;font color="#0000ff"&gt;foreach&lt;/font&gt;&lt;font size="2"&gt; (&lt;/font&gt;&lt;font color="#008080" size="2"&gt;XPathNavigator&lt;/font&gt;&lt;font size="2"&gt; resultsRow1 &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;in&lt;/font&gt;&lt;font size="2"&gt; queryDataFields.Select(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;*&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;))&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&amp;nbsp;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;&lt;/blockquote&gt;</description></item><item><title>Re: Limit number of rows returned from data connection?</title><link>https://www.infopathdev.com:443/forums/thread/36473.aspx</link><pubDate>Wed, 31 Dec 2008 18:01:32 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:36473</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/36473.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=36473</wfw:commentRss><description>&lt;p&gt;Well, mind you, I was just trying this by editing the SQL in a data connection in the data connection wizard... and then again in a direct query. Can&amp;#39;t imagine why it would work differently in code, though. I&amp;#39;m assuming when you test the two different query strings, you are using the same parameters for {0}, year &amp;amp; month.... :)&lt;/p&gt;</description></item><item><title>Re: Limit number of rows returned from data connection?</title><link>https://www.infopathdev.com:443/forums/thread/36471.aspx</link><pubDate>Wed, 31 Dec 2008 16:59:24 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:36471</guid><dc:creator>geoffc</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/36471.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=36471</wfw:commentRss><description>&lt;p&gt;That certainly throws a kink into things. When I insert the TOP expression, nothing is returned from the view. When I remove the TOP expression. values are returned. All I am doing is modifying the SQL statement. From this&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;font color="#0000ff" size="2"&gt;const&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;string&lt;/font&gt;&lt;font size="2"&gt; queryString2 = &lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;select * from [VIEW] where [FIELD1]=&amp;#39;{0}&amp;#39;&amp;nbsp;order by [YEAR] DESC ,[MONTH] DESC&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;to this:&lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt;&lt;font color="#0000ff" size="2"&gt;
&lt;p&gt;const&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;string&lt;/font&gt;&lt;font size="2"&gt; queryString2 = &lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;select TOP 5 * from [VIEW] where [FIELD1]=&amp;#39;{0}&amp;#39;&amp;nbsp;order by [YEAR] DESC ,[MONTH] DESC&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;</description></item><item><title>Re: Limit number of rows returned from data connection?</title><link>https://www.infopathdev.com:443/forums/thread/36466.aspx</link><pubDate>Wed, 31 Dec 2008 16:11:21 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:36466</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/36466.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=36466</wfw:commentRss><description>&lt;p&gt;Actually, I got curious and just tested this -- I tried using TOP to query a view in SQL Server Management Studio and it returned the 5 rows, as specified. Then I tried this as a SQL receive data connection in an IP 2007 form (editing the SQL command) and again had 5 rows returned. Could something else be preventing you from seeing the data you expect? &lt;/p&gt;</description></item><item><title>Re: Limit number of rows returned from data connection?</title><link>https://www.infopathdev.com:443/forums/thread/36465.aspx</link><pubDate>Wed, 31 Dec 2008 16:00:04 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:36465</guid><dc:creator>geoffc</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/36465.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=36465</wfw:commentRss><description>&lt;p&gt;Shiva, unfortunately I am restricted to using these pre-built views and the TOP command does not work with the views (no results are returned). Is there anything else you can think of? Thank you!&lt;/p&gt;</description></item><item><title>Re: Limit number of rows returned from data connection?</title><link>https://www.infopathdev.com:443/forums/thread/36455.aspx</link><pubDate>Wed, 31 Dec 2008 12:47:04 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:36455</guid><dc:creator>Shiva</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/36455.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=36455</wfw:commentRss><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;If you do not have permission to create any view you can write the below statement to give top 5 rows,&lt;/p&gt;
&lt;p&gt;const string queryString6 = &amp;quot;&lt;b&gt;select TOP 5 * from [TABLE] where [FIELD1]=&amp;#39;{0}&amp;#39; order by [YEAR] DESC, [MONTH] DESC&lt;/b&gt;&amp;quot;;&lt;/p&gt;</description></item><item><title>Re: Limit number of rows returned from data connection?</title><link>https://www.infopathdev.com:443/forums/thread/36453.aspx</link><pubDate>Wed, 31 Dec 2008 12:31:07 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:36453</guid><dc:creator>geoffc</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/36453.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=36453</wfw:commentRss><description>Hello Shiva, can you think of any other work arounds to just return the first five results? Unfortunately, I am not the dba so I do not have permissions to create new views. Thank you for your help. I really appreciate it!</description></item><item><title>Re: Limit number of rows returned from data connection?</title><link>https://www.infopathdev.com:443/forums/thread/36451.aspx</link><pubDate>Wed, 31 Dec 2008 11:55:16 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:36451</guid><dc:creator>Shiva</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/36451.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=36451</wfw:commentRss><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;First you have to execute that view (&lt;b&gt;newView&lt;/b&gt;) in your database. Then you have to write the statement to get the data from view as below,&lt;/p&gt;
&lt;p&gt;const string queryString6 = &amp;quot;&lt;b&gt;select * from newView&lt;/b&gt;&amp;quot;;&lt;/p&gt;
&lt;p&gt;Rest of the code no change.&lt;/p&gt;</description></item><item><title>Re: Limit number of rows returned from data connection?</title><link>https://www.infopathdev.com:443/forums/thread/36374.aspx</link><pubDate>Tue, 30 Dec 2008 13:47:28 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:36374</guid><dc:creator>geoffc</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/36374.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=36374</wfw:commentRss><description>&lt;font color="#0000ff" size="2"&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;Here is the&amp;nbsp;query string. However, i&amp;#39;m not sure how to integrate this new query string with my code to store the retrieved values into the nodes.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;const&lt;/font&gt;&lt;font color="#000000" size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;string&lt;/font&gt;&lt;font color="#000000" size="2"&gt; queryString6 = &lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;Create view newView as select TOP 5 * from [TABLE] where [FIELD1]=&amp;#39;{0}&amp;#39; order by [YEAR] DESC, [MONTH] DESC&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;
&lt;p&gt;if&lt;/font&gt;&lt;font size="2"&gt; (!&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;string&lt;/font&gt;&lt;font size="2"&gt;.IsNullOrEmpty(field1))&lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt;{&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#008080" size="2"&gt;AdoQueryConnection&lt;/font&gt;&lt;font size="2"&gt; dc = (&lt;/font&gt;&lt;font color="#008080" size="2"&gt;AdoQueryConnection&lt;/font&gt;&lt;font size="2"&gt;)DataConnections[&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;TABLE&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;];&lt;/p&gt;dc.Command = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;string&lt;/font&gt;&lt;font size="2"&gt;.Format(queryString6, uninum);&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;dc.Execute();&lt;/p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;string&lt;/font&gt;&lt;font size="2"&gt;[] columnNames = {&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;COL1&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;,&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;COL2&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;,&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;COL3&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;,&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;COL4&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;};&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;string&lt;/font&gt;&lt;font size="2"&gt; myNamespace = NamespaceManager.LookupNamespace(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;my&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;);&lt;/p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;string&lt;/font&gt;&lt;font size="2"&gt; dNamespace = NamespaceManager.LookupNamespace(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;d&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;);&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;string&lt;/font&gt;&lt;font size="2"&gt; blankNamespace = NamespaceManager.LookupNamespace(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;);&lt;/p&gt;&lt;/font&gt;&lt;font color="#008080" size="2"&gt;XPathNavigator&lt;/font&gt;&lt;font size="2"&gt; dataFields = MainDataSource.CreateNavigator().SelectSingleNode(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;/dfs:myFields/my:queryResults1&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager);&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#008080" size="2"&gt;XPathNavigator&lt;/font&gt;&lt;font size="2"&gt; queryDataFields = DataSources[&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;TABLE&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;].CreateNavigator();&lt;/p&gt;queryDataFields = queryDataFields.SelectSingleNode(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;/dfs:myFields/dfs:dataFields&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager);&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;while&lt;/font&gt;&lt;font size="2"&gt; (dataFields.MoveToChild(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;resultsRow1&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;, myNamespace))&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;dataFields.DeleteSelf();&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;foreach&lt;/font&gt;&lt;font size="2"&gt; (&lt;/font&gt;&lt;font color="#008080" size="2"&gt;XPathNavigator&lt;/font&gt;&lt;font size="2"&gt; resultsRow1 &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;in&lt;/font&gt;&lt;font size="2"&gt; queryDataFields.SelectChildren(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;TABLE&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;, dNamespace))&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;{&lt;/p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;using&lt;/font&gt;&lt;font size="2"&gt; (&lt;/font&gt;&lt;font color="#008080" size="2"&gt;XmlWriter&lt;/font&gt;&lt;font size="2"&gt; writer = dataFields.AppendChild())&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;{&lt;/p&gt;writer.WriteStartElement(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;resultsRow1&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;, myNamespace);&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;foreach&lt;/font&gt;&lt;font size="2"&gt; (&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;string&lt;/font&gt;&lt;font size="2"&gt; colName &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;in&lt;/font&gt;&lt;font size="2"&gt; columnNames)&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;writer.WriteStartElement(colName, myNamespace); &lt;/p&gt;
&lt;p&gt;writer.WriteValue(resultsRow1.GetAttribute(colName, blankNamespace));&lt;/p&gt;
&lt;p&gt;writer.WriteEndElement();&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;writer.WriteEndElement();&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;&lt;/font&gt;</description></item><item><title>Re: Limit number of rows returned from data connection?</title><link>https://www.infopathdev.com:443/forums/thread/36370.aspx</link><pubDate>Tue, 30 Dec 2008 13:05:39 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:36370</guid><dc:creator>Shiva</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/36370.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=36370</wfw:commentRss><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Can you try once below statement for creating the view,&lt;/p&gt;
&lt;p&gt;Create view newView as &lt;/p&gt;
&lt;p&gt;select TOP 5 * from [TABLE] where [FIELD1]=&amp;#39;{0}&amp;#39; and [FIELD2]=&amp;#39;{1}&amp;#39; order by [YEAR] DESC, [MONTH] DESC&amp;quot;;&lt;/p&gt;</description></item><item><title>Re: Limit number of rows returned from data connection?</title><link>https://www.infopathdev.com:443/forums/thread/36369.aspx</link><pubDate>Tue, 30 Dec 2008 12:17:31 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:36369</guid><dc:creator>geoffc</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/36369.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=36369</wfw:commentRss><description>&lt;p&gt;Yes, but for some reason this does not work when I query against a view and no results are returned. However, when I use this same statement for a table, it works wonderfully. Any ideas?&lt;/p&gt;</description></item><item><title>Re: Limit number of rows returned from data connection?</title><link>https://www.infopathdev.com:443/forums/thread/36346.aspx</link><pubDate>Tue, 30 Dec 2008 06:41:03 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:36346</guid><dc:creator>Shiva</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/36346.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=36346</wfw:commentRss><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Here is the change in your SQL statement,&lt;/p&gt;
&lt;p&gt;select &lt;b&gt;TOP 5&lt;/b&gt; * from [TABLE] where [FIELD1]=&amp;#39;{0}&amp;#39; and [FIELD2]=&amp;#39;{1}&amp;#39; order by [YEAR] DESC, [MONTH] DESC&amp;quot;;&lt;/p&gt;</description></item><item><title>Re: Limit number of rows returned from data connection?</title><link>https://www.infopathdev.com:443/forums/thread/36319.aspx</link><pubDate>Mon, 29 Dec 2008 12:58:47 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:36319</guid><dc:creator>geoffc</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/36319.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=36319</wfw:commentRss><description>Thank you for your reply Shiva. Would I be entering in this code through InfoPath or is this something I would have to set up in SQL first? I am currently constructing these queries in my InfoPath form since the queries rely on user input in two fields. The results are then stored in a repeating table. Here is an example query string that I am using:&lt;font color="#0000ff" size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt; 
&lt;p&gt;const&lt;/font&gt;&lt;font color="#000000" size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;string&lt;/font&gt;&lt;font color="#000000" size="2"&gt; queryString = &lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;select * from [TABLE] where [FIELD1]=&amp;#39;{0}&amp;#39; and [FIELD2]=&amp;#39;{1}&amp;#39; order by [YEAR] DESC, [MONTH] DESC&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;</description></item><item><title>Re: Limit number of rows returned from data connection?</title><link>https://www.infopathdev.com:443/forums/thread/36304.aspx</link><pubDate>Mon, 29 Dec 2008 06:45:47 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:36304</guid><dc:creator>Shiva</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/36304.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=36304</wfw:commentRss><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;We can do filter those using InfoPath filter condition and using code we can remove extra nodes. If we are doing in InfoPath filter condition or code also it will impact on performance. After getting the all rows we are filtering or removing means it takes unnecessarily time being this kind of operation. &lt;/p&gt;
&lt;p&gt;My suggestion while getting the number rows limitation is should be in database. Here is the link to create the view using top command,&lt;/p&gt;
&lt;p&gt;&lt;a href="http://sqlug.be/blogs/resource_blog/archive/2008/07/09/sql-server-2005-vs-2000-views-with-top-percent-order-by.aspx"&gt;http://sqlug.be/blogs/resource_blog/archive/2008/07/09/sql-server-2005-vs-2000-views-with-top-percent-order-by.aspx&lt;/a&gt;&lt;/p&gt;</description></item></channel></rss>