﻿<?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?)  » Backend SQL Commands in BO</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Fri, 01 May 2026 04:57:18 GMT</lastBuildDate><ttl>20</ttl><item><title>Backend SQL Commands in BO</title><link>http://forum.strataframe.net/FindPost30267.aspx</link><description>I know that this command in the programs file will show you the actual command sent to the backend: &lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;MicroFour.StrataFrame.Data.DataBasics.DataSources[0].SetDebugOn("C:\\ValetLog.html", true);&lt;br/&gt;&lt;br/&gt;&lt;font color="#000000"&gt;What command would I insert in my base bo to get this command when SAVE is clicked. That would get me the INSERTs and UPDATEs. Then what command would I use to get the DELETE. Lastly what method in the BO would these commands be placed.&lt;/font&gt;&amp;nbsp;&lt;br/&gt;&lt;br/&gt;&lt;/font&gt;&lt;/font&gt;&amp;nbsp;</description><pubDate>Fri, 26 Aug 2011 11:46:27 GMT</pubDate><dc:creator>Ross L. Rooker, Sr.</dc:creator></item><item><title>RE: Backend SQL Commands in BO</title><link>http://forum.strataframe.net/FindPost30272.aspx</link><description>In the future if you could somehow allow this to more easily be captured would be great. I have a full Activity Log working now. Just thought it might be cool to capture the actual INSERT, UPDATE or DELETE command issued against the backend. THanks for the quick response.</description><pubDate>Fri, 26 Aug 2011 11:46:27 GMT</pubDate><dc:creator>Ross L. Rooker, Sr.</dc:creator></item><item><title>RE: Backend SQL Commands in BO</title><link>http://forum.strataframe.net/FindPost30271.aspx</link><description>Well, actually, now that I think about it, if you want to capture the same content as the debug mode, you will have to create your own DbDataSourceItem.&amp;nbsp; The easiest thing to do would be to copy over the SqlDbDataSourceItem or Oracle, whichever you are using, and create your own in your project. The method that you will need to place your logic is in the InternalExecuteNonQuery method.&amp;nbsp; This is what it looks like at the moment:&lt;br/&gt;&lt;br/&gt;&lt;span&gt;[codesnippet]&lt;br/&gt;&lt;/span&gt;''' &amp;lt;summary&amp;gt;&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ''' Executes the given DbCommand with ExecuteNonQuery with debugging.&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ''' &amp;lt;/summary&amp;gt;&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Protected Function InternalExecuteNonQuery(ByVal Command As DbCommand, ByVal IsTransactional As Boolean, ByVal TransactionKey As String) As Integer&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If Me._InternalExecuteNonQuery IsNot Nothing Then&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return Me._InternalExecuteNonQuery(Command, IsTransactional, TransactionKey)&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Else&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-- Show the debugging window&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.DebugCommand(Command)&lt;br/&gt;&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-- Make sure the connection is open&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If Command.Connection.State &amp;lt;&amp;gt; ConnectionState.Open Then&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Command.Connection.Open()&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;br/&gt;&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-- Execute the command&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim lnReturn As Integer = Command.ExecuteNonQuery()&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If Not IsTransactional AndAlso Me.ForceConnectionCloseOpen Then&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Command.Connection.Close()&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Command.Connection.Open()&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return lnReturn&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Function&lt;br/&gt;&lt;span&gt;[/codesnippet]&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;So to do what you are trying to do would require that you copy over the full class (since at the moment this method is not overridable) and then insert your logic in the above method around the DebugCommand logic to get what you are looking for.&amp;nbsp; The reason is that this is the base location that actually builds the Command.&amp;nbsp; When a BO is saved, it uses the QueryInfo class that gets handed down to the DbDataSourceItem (Data Layer) that calls the appropriate Build command to produce the actual DbCommand.&amp;nbsp; This is how a BO can just swap out the back-end and connection logic, otherwise the BO would be hard coded to that data source.&lt;br/&gt;&lt;br/&gt;I will see if we can add a potential event in a future build to capture this, but the downside is that an event would be called and could slow this process down.&amp;nbsp; The best way really is to do this at the DbDataSourceItem level.&amp;nbsp; The only other thing that would help is to make all of these methods overridable so that inheritance would work in this case.&amp;nbsp; This much we can do without any issue or performance bottleneck.</description><pubDate>Fri, 26 Aug 2011 11:30:19 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Backend SQL Commands in BO</title><link>http://forum.strataframe.net/FindPost30270.aspx</link><description>I inserted this into my BaseBO. The problem is that it does not appear as though it is being fired I am not seeing anything in the Console output window during execution.&lt;br/&gt;&lt;br/&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;h3 style="margin-right: 0px;" align="left"&gt;protected override int ExecuteNonQuery(System.Data.Common.DbCommand CommandToExecute)&lt;/h3&gt;&lt;h3 style="margin-right: 0px;" align="left"&gt;&lt;/h3&gt;&lt;h3 style="margin-right: 0px;" align="left"&gt;        {&lt;/h3&gt;&lt;h3 style="margin-right: 0px;" align="left"&gt;&lt;/h3&gt;&lt;h3 style="margin-right: 0px;" align="left"&gt;            &lt;/h3&gt;&lt;h3 style="margin-right: 0px;" align="left"&gt;//-- You can use the CommandToExecute to pull out everything you need at this point.  For example, CommandToExecute.CommandText will&lt;/h3&gt;&lt;h3 style="margin-right: 0px;" align="left"&gt;&lt;/h3&gt;&lt;h3 style="margin-right: 0px;" align="left"&gt;            &lt;/h3&gt;&lt;h3 style="margin-right: 0px;" align="left"&gt;//    give you the command text and then you can look at the .Parameters collection to get all of the parms.&lt;/h3&gt;&lt;h3 style="margin-right: 0px;" align="left"&gt;&lt;/h3&gt;&lt;h3 style="margin-right: 0px;" align="left"&gt;            &lt;/h3&gt;&lt;h3 style="margin-right: 0px;" align="left"&gt;Console.WriteLine("CommandToExecute= " + CommandToExecute.CommandText.ToString());&lt;/h3&gt;&lt;h3 style="margin-right: 0px;" align="left"&gt;&lt;/h3&gt;&lt;h3 style="margin-right: 0px;" align="left"&gt;            &lt;/h3&gt;&lt;h3 style="margin-right: 0px;" align="left"&gt;//-- Perform the standard logic&lt;/h3&gt;&lt;h3 style="margin-right: 0px;" align="left"&gt;&lt;/h3&gt;&lt;h3 style="margin-right: 0px;" align="left"&gt;            &lt;/h3&gt;&lt;h3 style="margin-right: 0px;" align="left"&gt;return base.ExecuteNonQuery(CommandToExecute);&lt;/h3&gt;&lt;h3 style="margin-right: 0px;" align="left"&gt;&lt;/h3&gt;&lt;h3 style="margin-right: 0px;" align="left"&gt;        }&lt;/h3&gt;</description><pubDate>Fri, 26 Aug 2011 11:08:26 GMT</pubDate><dc:creator>Ross L. Rooker, Sr.</dc:creator></item><item><title>RE: Backend SQL Commands in BO</title><link>http://forum.strataframe.net/FindPost30269.aspx</link><description>Let me see if I understand, you are wanting to capture the actual SQL command that is executed along with the parms, etc. when Save is executed on the BO, correct?&amp;nbsp; If this is the case, then you will want to override the ExecuteNonQuery method in your base BO and it will give you the command that will be executed:&lt;br/&gt;&lt;br/&gt;&lt;span&gt;[codesnippet]&lt;br/&gt;&lt;/span&gt;''' &amp;lt;summary&amp;gt;&lt;br/&gt;''' Overrides the ExecuteNonQuery() method of the base class.&lt;br/&gt;''' &amp;lt;/summary&amp;gt;&lt;br/&gt;Protected Overrides Function ExecuteNonQuery(ByVal CommandToExecute As System.Data.Common.DbCommand) As Integer&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-- You can use the CommandToExecute to pull out everything you need at this point.&amp;nbsp; For example, CommandToExecute.CommandText will&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '&amp;nbsp;&amp;nbsp;&amp;nbsp; give you the command text and then you can look at the .Parameters collection to get all of the parms.&lt;br/&gt;&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-- Perform the standard logic&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return MyBase.ExecuteNonQuery(CommandToExecute)&lt;br/&gt;End Function&lt;br/&gt;&lt;span&gt;[/codesnippet]&lt;/span&gt;</description><pubDate>Fri, 26 Aug 2011 10:26:49 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item></channel></rss>