﻿<?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?)  » FillByParent</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Mon, 08 Jun 2026 20:27:44 GMT</lastBuildDate><ttl>20</ttl><item><title>FillByParent</title><link>http://forum.strataframe.net/FindPost17691.aspx</link><description>If I attempt to use the FillByParent Method where the Parent has more than 2100 records the method fails with the following exception. I may have a few places where it is possible that the user can select more than 2100 parent records and a fill by parent would be called. I havent looked into how the fillbyparent method works yet but was hoping for any suggestions on how to best handle this.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;P&gt;[codesnippet]InnerException: System.Data.SqlClient.SqlException&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Class=16&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ErrorCode=-2146232060&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LineNumber=1&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Message="The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Too many parameters were provided in this RPC request. The maximum is 2100."&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Number=8003&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Procedure=""&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Server="ares"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Source=".Net SqlClient Data Provider"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; State=1[/codesnippet]</description><pubDate>Thu, 10 Jul 2008 18:50:08 GMT</pubDate><dc:creator>Paul Chase</dc:creator></item><item><title>RE: FillByParent</title><link>http://forum.strataframe.net/FindPost17784.aspx</link><description>Thanks&amp;nbsp;Ben,&lt;/P&gt;&lt;P&gt;I was thinking along the lines of the first&amp;nbsp;suggestion you had&amp;nbsp;anways&amp;nbsp;,&amp;nbsp;I just haven't gotten back to it yet, it&amp;nbsp;should be an infrequent thing but it is possible&amp;nbsp;and valid&amp;nbsp;for a user to need that much data&amp;nbsp;so for the time being&amp;nbsp;I put in a freindly message that&amp;nbsp;lets the user know that they are selecting to many records and bail just to keep the whining to a minumum. most likely&amp;nbsp;I will implement the first route and come back to the CLR to improve perfomance.</description><pubDate>Thu, 10 Jul 2008 18:50:08 GMT</pubDate><dc:creator>Paul Chase</dc:creator></item><item><title>RE: FillByParent</title><link>http://forum.strataframe.net/FindPost17757.aspx</link><description>If you go the CLR UDF route, your query would then look like this:&lt;/P&gt;&lt;P&gt;SELECT [fields] FROM ChildTable AS CT INNER JOIN dbo.Udf_ByteParser(@pks) AS BP ON CT.foreignkey = BP.primarykey&lt;/P&gt;&lt;P&gt;The @pks would be the byte[] containing the pk values</description><pubDate>Thu, 10 Jul 2008 10:07:45 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: FillByParent</title><link>http://forum.strataframe.net/FindPost17756.aspx</link><description>The FillByParent method creates a big query that fills by the foreign key of the child using an IN() to list the primary keys of the parent.&amp;nbsp; So, say the parent is filled with 5 records, pk 2,4,6,8, &amp;amp; 10.&amp;nbsp; The query would look like this:&lt;/P&gt;&lt;P&gt;SELECT [allfields list] FROM ChildSchema.ChildTable WHERE foreignkey IN (@p1,@p2,@p3,@p4,@p5)&lt;/P&gt;&lt;P&gt;with the @p1-5 being the evens 2-10.&amp;nbsp; The TDS parser of SQL Server only supports 2100 parameters; though I have had problems with more than 1000.&amp;nbsp; Basically, when we tried to do this in a VFP setting (only supported ~25 parameters before it died), we had to break the command into multiple queries, pass 25 parameters at a time, and AppendDataTable() the results into the business object.&lt;/P&gt;&lt;P&gt;Congratulations, though, Paul, you're the first person to reach the 2100 limit on SQL Server :)&lt;/P&gt;&lt;P&gt;Basically, if you need it soon, you could write your own method using the source from the current FillByParent and break the query into several queries and AppendDataTable() the results each time.&amp;nbsp; We'll also modify the FillByParent to use separate commands if it gets larger than 2100, but I can't guarantee when that will happen.&lt;/P&gt;&lt;P&gt;Also, if you really wanted to get creative ;), you could use a System.IO.BinaryWriter to write a byte[] of the primary keys from the business object.&amp;nbsp; You could then pass that byte[] to a CLR table-valued UDF that would return a single column of the pks.&amp;nbsp; You could then join this result-set into the child table on the foreign key and get all of the records in one big query.&amp;nbsp; In fact, that would probably give you much better performance than using the IN() operator of SQL Server (a join is always going to be faster than using an IN).&amp;nbsp; We've had to use this functionality (passing byte arrays into SQL server and converting them into joinable result-sets) because we had some non-committed records that we had to use in a query (so the user didn't have to save before getting some info we were calculating).</description><pubDate>Thu, 10 Jul 2008 10:04:09 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item></channel></rss>