﻿<?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?)  » Using a BusinessLayer to fill a specific BO</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 01:38:39 GMT</lastBuildDate><ttl>20</ttl><item><title>Using a BusinessLayer to fill a specific BO</title><link>http://forum.strataframe.net/FindPost12237.aspx</link><description>Can I use a generic BusinessLayer to fill a specific BO if the datatable in the BusinessLayer is filled in a way that the BO can handle?&lt;br&gt;
&lt;br&gt;
I.e. I have a CustomersBO with these fields:&lt;br&gt;
&lt;br&gt;
CustID&lt;br&gt;
CustName&lt;br&gt;
&lt;br&gt;
Then I instantiate a BusinessLayer and use FillDataTable with SQL like this:&lt;br&gt;
&lt;br&gt;
[codesnippet]Dim bo As New BusinessLayer()&lt;br&gt;
bo.FillDataTable("Select CustID, CustName From Customers")[/codesnippet]&lt;br&gt;
&lt;br&gt;
Can I then do:&lt;br&gt;
&lt;br&gt;
[codesnippet]CustomersBO.CopyDataFrom(bo,ClearAndFillFromCompleteTable)[/codesnippet]</description><pubDate>Tue, 30 Oct 2007 10:29:51 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Using a BusinessLayer to fill a specific BO</title><link>http://forum.strataframe.net/FindPost12282.aspx</link><description>Thanks for the reply Ben. It is all making sense now. I haven't done much at the data layer directly, so I appreciate Paul's comments a lot!</description><pubDate>Tue, 30 Oct 2007 10:29:51 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Using a BusinessLayer to fill a specific BO</title><link>http://forum.strataframe.net/FindPost12272.aspx</link><description>Paul's option is a good one and it does save the overhead of instantiating another business object.&lt;/P&gt;&lt;P&gt;But, a business object can store data that does not match it's strong-typed properties, so you could really use any business object and fill it.&amp;nbsp; Just don't go trying to access those strong-typed properties that don't have a backing field, or you'll get a nice exception ;)&lt;/P&gt;&lt;P&gt;Using Paul's option is cleaner.&lt;/P&gt;&lt;P&gt;Oh, and there's also the CopyDataFrom() and MergeDataFrom() overloads that accept DataTable parameters if you won't want to use the Load method directly on the CurrentDataTable.</description><pubDate>Tue, 30 Oct 2007 09:25:27 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: Using a BusinessLayer to fill a specific BO</title><link>http://forum.strataframe.net/FindPost12254.aspx</link><description>That could work...and it saves the extra overhead of the BO.  I'll try that. Thanks Paul!</description><pubDate>Mon, 29 Oct 2007 23:09:59 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Using a BusinessLayer to fill a specific BO</title><link>http://forum.strataframe.net/FindPost12246.aspx</link><description>Greg,&lt;/P&gt;&lt;P&gt;I'm not sure what you a trying to do but why not something like this&lt;/P&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Dim&lt;/FONT&gt;&lt;FONT size=2&gt; loTable &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; Data.DataTable&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;Fill the Data Table&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;loTable = MicroFour.StrataFrame.Data.DataBasics.DataSources(&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;""&lt;/FONT&gt;&lt;FONT size=2&gt;).GetDataTable(&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"Select CustID, CustName From Customers"&lt;/FONT&gt;&lt;FONT size=2&gt;, &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Nothing&lt;/FONT&gt;&lt;FONT size=2&gt;)&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;'Not sure if you need to clear it&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;CustomerBo.CurrentDataTable.Clear()&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;'Load the data from the Table&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;CustomerBo.CurrentDataTable.Load(loTable.CreateDataReader, Data.LoadOption.OverwriteChanges)&lt;/P&gt;&lt;/FONT&gt;</description><pubDate>Mon, 29 Oct 2007 15:41:50 GMT</pubDate><dc:creator>Paul Chase</dc:creator></item><item><title>RE: Using a BusinessLayer to fill a specific BO</title><link>http://forum.strataframe.net/FindPost12241.aspx</link><description>bump...</description><pubDate>Mon, 29 Oct 2007 11:10:50 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item></channel></rss>