﻿<?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 the BO.Seek() method to find duplicate record in current view....</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 08 Sep 2026 13:25:32 GMT</lastBuildDate><ttl>20</ttl><item><title>Using the BO.Seek() method to find duplicate record in current view....</title><link>http://forum.strataframe.net/FindPost16872.aspx</link><description>Hi All,&lt;P&gt;I have a process that will create some customer payment records, in this process I can not allow a duplicate record to be created, so in my process I need to look for any possible duplicate record and then skip the creation of the duplicate one.&lt;/P&gt;&lt;P&gt;I am trying to do this with the BO.Seek, but I am getting an error which I can not properly identify.&amp;nbsp; Here my code:&lt;/P&gt;&lt;P&gt;[quote][codesnippet]&lt;FONT size=2&gt;&lt;/P&gt;&lt;P&gt;strSeekWhere(&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"FK_InsuredCustomer=51 and FK_Vehicle=0 and FK_Policy=34 and PaymentNumber=0 and PaymentDueDate=5/31/2008 12:00:00 AM and PaymentAmount=500.0000"&lt;/FONT&gt;&lt;FONT size=2&gt;)&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;If&lt;/FONT&gt;&lt;FONT size=2&gt; loCurrentPaymentScheduleBO.Seek(strSeekWhere) &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Then&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Continue&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;For&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;If&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;[/codesnippet][/quote]&lt;/P&gt;&lt;P&gt;Here is the exeption error:&lt;/P&gt;&lt;P&gt;[quote]SyntaxErrorException&lt;BR&gt;&amp;nbsp; Syntax error: Missing operand after '12' operator.&lt;/P&gt;&lt;P&gt;Source&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : System.Data&lt;/P&gt;&lt;P&gt;Stack Trace: &lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Data.ExpressionParser.Parse()&lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Data.DataExpression..ctor(DataTable table, String expression, Type type)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Data.Select..ctor(DataTable table, String filterExpression, String sort, DataViewRowState recordStates)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Data.DataTable.Select(String filterExpression, String sort, DataViewRowState recordStates)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at MicroFour.StrataFrame.Business.BusinessLayer.Seek(String WhereClause)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at IBS_BOL.PolicyBO.CreatePaymentSchedule(Int32 pInsuredCustomerPK, PaymentScheduleBO loCurrentPaymentScheduleBO, DateTime PaymentStartDate, Int32 pVehiclePK) in E:\Visual Studio 2008 Projects\StrataFrame\Insurance Broker System (SF)\BOL\IBS_BOL\Main Forms BOs\PolicyBO.vb:line 217&lt;BR&gt;&amp;nbsp;&amp;nbsp; at IBS_UI.frmPolicy.tsbCreatePaymentSchedule_Click(Object sender, EventArgs e) in E:\Visual Studio 2008 Projects\StrataFrame\Insurance Broker System (SF)\UI\Main Forms\frmPolicy.vb:line 389&lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.Control.WmMouseUp(Message&amp;amp; m, MouseButtons button, Int32 clicks)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.Control.WndProc(Message&amp;amp; m)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.ScrollableControl.WndProc(Message&amp;amp; m)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.ToolStrip.WndProc(Message&amp;amp; m)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.Control.ControlNative&amp;#119;indow.OnMessage(Message&amp;amp; m)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.Control.ControlNative&amp;#119;indow.WndProc(Message&amp;amp; m)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.Native&amp;#119;indow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)&lt;BR&gt;[/quote]&lt;P&gt;What am I doing wrong here? or is there any other way to try to identify a possible duplicate record in the BO.CurrentView.</description><pubDate>Mon, 27 Oct 2008 09:11:15 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Using the BO.Seek() method to find duplicate record in current view....</title><link>http://forum.strataframe.net/FindPost20373.aspx</link><description>They would both go in the BO when validating through the CheckRulesOnCurrentRow event.&amp;nbsp; This was just to show that you may need to query uncommitted records as well in addition to those checked on the server to get 100% coverage.&amp;nbsp; This isn't always necessary, I just thought I would bring it to your attention.</description><pubDate>Mon, 27 Oct 2008 09:11:15 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Using the BO.Seek() method to find duplicate record in current view....</title><link>http://forum.strataframe.net/FindPost20365.aspx</link><description>Hi Trent&lt;/P&gt;&lt;P&gt;Thanks for you comment. The other solution is in the BO, this validation you mention, Where should it go? I think that in the Validating event of the control, but I'm not sure.&lt;/P&gt;&lt;P&gt;About localization, I'm working in two apps right now. One has localization for every part of it because is English/Spanish, but the other no, that's why I'm using only direct text for messages.&lt;/P&gt;&lt;P&gt;Kindest regards</description><pubDate>Sun, 26 Oct 2008 15:25:39 GMT</pubDate><dc:creator>Juan Carlos Pazos</dc:creator></item><item><title>RE: Using the BO.Seek() method to find duplicate record in current view....</title><link>http://forum.strataframe.net/FindPost20359.aspx</link><description>One other thought to cap off this post, all of the server side query information from my posts and others is on target, but if you have the need to query within the BO (uncommitted reecord) as well, call a Select on the CurrentDataTable to get a count of records:&lt;/P&gt;&lt;P&gt;[codesnippet]Dim hasDupe As Boolean&lt;/P&gt;&lt;P&gt;hasDupe = MyBo.CurrentDataTable.Select("MyPk &amp;lt;&amp;gt; 1 AND MyLastName = 'Taylor'").Length &amp;gt; 0[/codesnippet]&lt;/P&gt;&lt;P&gt;You can use this in conjunction with the server side query.&amp;nbsp; Do one and then the other to make sure that there are no dupes on either side of the committed records.&lt;/P&gt;&lt;P&gt;Also, Ivan's suggestions about the localization records are good...it is a much better way to keep up with your messages, etc.&amp;nbsp; Especially if you have the need to localize an app!</description><pubDate>Sun, 26 Oct 2008 10:29:57 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Using the BO.Seek() method to find duplicate record in current view....</title><link>http://forum.strataframe.net/FindPost20352.aspx</link><description>Glad you got it going, Juan!&lt;/P&gt;&lt;P&gt;Just for you to think about, have a look at the Localization &amp;amp; Message Editor. It might be a good idea to start creating your messages with it, and then use it in your application using the message keys, instead of entering an string directly. This way not only you get a centralized editor for all your messages, but are only 1 step away from having a multi-language application.&lt;/P&gt;&lt;P&gt;Have a great weekend. :cool:</description><pubDate>Sat, 25 Oct 2008 14:58:54 GMT</pubDate><dc:creator>Ivan George Borges</dc:creator></item><item><title>RE: Using the BO.Seek() method to find duplicate record in current view....</title><link>http://forum.strataframe.net/FindPost20351.aspx</link><description>Hi Ivan&lt;/P&gt;&lt;P&gt;;) You are right. Thanks&lt;/P&gt;&lt;P&gt;Before read this, I take a look to StrataFlix and found the same thing, I just adapt to my own BO and all works. Thanks for you help.&lt;/P&gt;&lt;P&gt;[codesnippet]&lt;FONT size=2&gt;&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Private&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Sub&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; GuiasEnviosBO_CheckRulesOnCurrentRow(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;ByVal&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; e &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; MicroFour.StrataFrame.Business.CheckRulesEventArgs)&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;&lt;FONT color=#008000 size=2&gt;'-- Verifica que si se ingreso el n£mero de gu¡a sea £nico&lt;/P&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;&lt;FONT color=#0000ff size=2&gt;If&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.NumeroGuia.Length &amp;gt; 0 &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;AndAlso&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; (&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Not&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; EsGuiaUnica()) &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Then&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.AddBrokenRule(GuiasEnviosBOFieldNames.NumeroGuia, &lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;"El n£mero de gu¡a ya ha sido utilizado."&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;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Sub&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;/FONT&gt;[/codesnippet]&lt;/P&gt;&lt;P&gt;[codesnippet]&lt;FONT size=2&gt;&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Private&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Function&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; EsGuiaUnica() &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Boolean&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;&lt;FONT color=#008000 size=2&gt;'-- Establish Locals&lt;/P&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;&lt;FONT color=#0000ff size=2&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; cmd &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;New&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; SqlCommand(&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;"SELECT COUNT(*) FROM GuiasEnvios WHERE IdGuia != @idGuia AND NumeroGuia = @numeroGuia"&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;)&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;&lt;FONT color=#008000 size=2&gt;'-- Create the parms&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;cmd.Parameters.AddWithValue(&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;"@idGuia"&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;, IdGuia).SqlDbType = SqlDbType.Int&lt;/P&gt;&lt;P&gt;cmd.Parameters.AddWithValue(&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;"@numeroGuia"&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;, NumeroGuia).SqlDbType = SqlDbType.VarChar&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;&lt;FONT color=#008000 size=2&gt;'-- Return the results&lt;/P&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;&lt;FONT color=#0000ff size=2&gt;Return&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;CType&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.ExecuteScalar(cmd), &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Integer&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;) = 0&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Function&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;/FONT&gt;[/codesnippet]&lt;/P&gt;&lt;P&gt;Kindest regards</description><pubDate>Sat, 25 Oct 2008 13:28:27 GMT</pubDate><dc:creator>Juan Carlos Pazos</dc:creator></item><item><title>RE: Using the BO.Seek() method to find duplicate record in current view....</title><link>http://forum.strataframe.net/FindPost20350.aspx</link><description>Sorry Juan, I should have read it more carefully.&lt;P&gt;Have a look at your IF statement:&lt;/P&gt;&lt;P&gt;[quote]&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;If&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; IsUniqueCode(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.IdGuia, &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.NumeroGuia) &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Then&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff&gt;[/quote]&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;You are testing if it IS unique. You probably want to test if it is NOT unique. ;)</description><pubDate>Sat, 25 Oct 2008 12:37:59 GMT</pubDate><dc:creator>Ivan George Borges</dc:creator></item><item><title>RE: Using the BO.Seek() method to find duplicate record in current view....</title><link>http://forum.strataframe.net/FindPost20349.aspx</link><description>Hi Ivan&lt;/P&gt;&lt;P&gt;I have one record, after add the first if I add a new one (with different number) fires the duplicate record message, also if I try to edit the same record.&lt;/P&gt;&lt;P&gt;Regards</description><pubDate>Sat, 25 Oct 2008 11:31:39 GMT</pubDate><dc:creator>Juan Carlos Pazos</dc:creator></item><item><title>RE: Using the BO.Seek() method to find duplicate record in current view....</title><link>http://forum.strataframe.net/FindPost20346.aspx</link><description>Hi Juan.&lt;/P&gt;&lt;P&gt;Have a look at your table and see if you don't have already more than 1 record with the same NumeroGuia content.</description><pubDate>Sat, 25 Oct 2008 08:47:08 GMT</pubDate><dc:creator>Ivan George Borges</dc:creator></item><item><title>RE: Using the BO.Seek() method to find duplicate record in current view....</title><link>http://forum.strataframe.net/FindPost20343.aspx</link><description>Hi&lt;/P&gt;&lt;P&gt;I take a look to the samples provided for check for duplicates, but I can not find how to work on this.&lt;/P&gt;&lt;P&gt;In the same situation as Edjy, Where does should the Function &lt;FONT size=2&gt;IsUniqueCode should go.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;I put this in the BO like this:&lt;/FONT&gt;&lt;/P&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Public&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Function&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; IsUniqueCode(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;ByVal&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; IdRegistro &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Integer&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;, &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;ByVal&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; GuiaNumero &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;String&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;) &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Boolean&lt;/P&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;&lt;FONT color=#0000ff size=2&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; cmd &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;New&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; SqlCommand(&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;"SELECT COUNT(*) FROM GuiasEnvios WHERE IdGuia != @idGuia AND NumeroGuia = @numeroGuia"&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;)&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;&lt;FONT color=#008000 size=2&gt;'-- Create the parms. The reason you include the current record PK is so that the current record&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;&lt;FONT color=#008000 size=2&gt;' will be ignored and only look for other records with the same code value.&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;cmd.Parameters.AddWithValue(&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;"@idGuia"&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;, IdRegistro).SqlDbType = SqlDbType.Int&lt;/P&gt;&lt;P&gt;cmd.Parameters.AddWithValue(&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;"@numeroGuia"&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;, GuiaNumero).SqlDbType = SqlDbType.VarChar&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;&lt;FONT color=#008000 size=2&gt;'-- Execute and return the results&lt;/P&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;&lt;FONT color=#0000ff size=2&gt;Return&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;CType&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.ExecuteScalar(cmd), &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Integer&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;) = 0&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Function&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;P&gt;&lt;FONT size=2&gt;&amp;nbsp;and call this way in the BO:&lt;/FONT&gt;&lt;/P&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Private&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Sub&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; GuiasEnviosBO_CheckRulesOnCurrentRow(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;ByVal&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; e &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; MicroFour.StrataFrame.Business.CheckRulesEventArgs)&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;If&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; IsUniqueCode(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.IdGuia, &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.NumeroGuia) &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Then&lt;/P&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;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.AddBrokenRule(GuiasEnviosBOFieldNames.NumeroGuia, &lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;"Duplicated"&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;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;If&lt;/P&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;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Sub&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#1f5080&gt;But when I edit the record It says that the record value is duplicated, so it's not ignoring the current record. Also if I add a new one.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#1f5080&gt;Hope you can point me in the rigth path.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#1f5080&gt;Regards&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;</description><pubDate>Sat, 25 Oct 2008 03:07:09 GMT</pubDate><dc:creator>Juan Carlos Pazos</dc:creator></item><item><title>RE: Using the BO.Seek() method to find duplicate record in current view....</title><link>http://forum.strataframe.net/FindPost16895.aspx</link><description>Trent, Greg,&lt;/P&gt;&lt;P&gt;Thanks again for the good advice.&lt;/P&gt;&lt;P&gt;I will create the scalar method just to be on the safe side.&amp;nbsp; In this case, the payments will be created only by one user, just to make sure it is correct, and this is done once a year.&amp;nbsp; I just wanted to add a bit of code to make sure in case that person need to delete a payment record (which of course has not been paid) could do so and that the routine to do it should make sure not duplicate payments records be created.&amp;nbsp; &lt;/P&gt;&lt;P&gt;In this case the PaymentScheduleBO should always have filled with all the payments to validate, but the scalar method idea will add another safety and fool proof this process even more.</description><pubDate>Fri, 06 Jun 2008 16:28:16 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Using the BO.Seek() method to find duplicate record in current view....</title><link>http://forum.strataframe.net/FindPost16884.aspx</link><description>Good to hear Edhy!  Yeah, I use the string format command a lot too. :D&lt;br&gt;
&lt;br&gt;
I also second what Trent is saying, that you might just consider using the scalar method to check the db directly. My first thought when reading this was "what if another user added an payment after the BO was filled?".</description><pubDate>Fri, 06 Jun 2008 11:40:36 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Using the BO.Seek() method to find duplicate record in current view....</title><link>http://forum.strataframe.net/FindPost16878.aspx</link><description>All good stuff...the only time that this will not work for you Edhy, is if you don't have all of the records in the BO itself.&amp;nbsp; In that case, you will want to create a scalar method and query the server...this is generally what we will do.&amp;nbsp; For example:&lt;/P&gt;&lt;P&gt;[codesnippet]Private Function IsUniqueCode(ByVal currentRecordPk As Integer, ByVal customerCode as String) As Boolean&lt;BR&gt;Dim cmd As New SqlCommand("SELECT COUNT(*) FROM Customers WHERE cs_pk != @currentRecordPk AND cs_CustomerCode = @customerCode")&lt;BR&gt;&lt;BR&gt;'-- Create the parms.&amp;nbsp; The reason you include the current record PK is so that the current record&lt;BR&gt;'&amp;nbsp;&amp;nbsp;&amp;nbsp; will be ignored and only look for other records with the same code value.&lt;BR&gt;cmd.Parameters.AddWithValue("@currentRecordPk",currentRecordPk).SqlDbType = SqlDbType.Int&lt;BR&gt;cmd.Parameters.AddWithValue("@customerCode",customerCode).SqlDbType = SqlDbType.VarChar&lt;/P&gt;&lt;P&gt;'-- Execute and return the results&lt;BR&gt;Return CType(Me.ExecuteScalar(cmd), Integer) = 0&lt;/P&gt;&lt;P&gt;End Function[/codesnippet]&lt;/P&gt;&lt;P&gt;If you have the need, you can then combine an internal search of the BO with the testing of the value on the server.</description><pubDate>Fri, 06 Jun 2008 08:29:38 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Using the BO.Seek() method to find duplicate record in current view....</title><link>http://forum.strataframe.net/FindPost16875.aspx</link><description>[quote][b]Greg McGuffey (06/05/2008)[/b][hr]you aren't delimiting the date. Try putting ## around the date...[/quote]&lt;/P&gt;&lt;P&gt;Hi Greg,&lt;/P&gt;&lt;P&gt;That was it!&amp;nbsp; I am trying to format the values use in the filter and did not noticed that the date was coming out without the ##.&amp;nbsp; I am falling in love with the String.Format command, here the final version:&lt;/P&gt;&lt;P&gt;[quote][codesnippet]&lt;FONT size=2&gt;&lt;/P&gt;&lt;P&gt;strSeekWhere = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;String&lt;/FONT&gt;&lt;FONT size=2&gt;.Format(&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"FK_InsuredCustomer={0} and FK_Vehicle={1} and FK_Policy={2} and PaymentNumber={3} and &lt;STRONG&gt;PaymentDueDate=#{4}#&lt;/STRONG&gt; and PaymentAmount={5}"&lt;/FONT&gt;&lt;FONT size=2&gt;, pInsuredCustomerPK, pVehiclePK, &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;FONT size=2&gt;.PK_Policy, PaymentNumber, PaymentDueDateItem, PaymentAmountDueItem)&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;[/codesnippet][/quote]&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;a lot!</description><pubDate>Thu, 05 Jun 2008 18:50:26 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Using the BO.Seek() method to find duplicate record in current view....</title><link>http://forum.strataframe.net/FindPost16874.aspx</link><description>Oops, I tried to bold the #, which didn't show up very well and left a [b] in the code:&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
[codesnippet]strSeekWhere("FK_InsuredCustomer=51 and FK_Vehicle=0 and FK_Policy=34 and PaymentNumber=0 and PaymentDueDate=#5/31/2008 12:00:00 AM# and PaymentAmount=500.0000")&lt;br&gt;
&lt;br&gt;
If loCurrentPaymentScheduleBO.Seek(strSeekWhere) Then&lt;br&gt;
&lt;br&gt;
    Continue For&lt;br&gt;
&lt;br&gt;
End If&lt;br&gt;
[/codesnippet]</description><pubDate>Thu, 05 Jun 2008 18:39:25 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Using the BO.Seek() method to find duplicate record in current view....</title><link>http://forum.strataframe.net/FindPost16873.aspx</link><description>you aren't delimiting the date.  Try putting ## around the date...&lt;br&gt;
[codesnippet]strSeekWhere("FK_InsuredCustomer=51 and FK_Vehicle=0 and FK_Policy=34 and PaymentNumber=0 and PaymentDueDate=#5/31/2008 12:00:00 AM[b]# and PaymentAmount=500.0000")&lt;br&gt;
&lt;br&gt;
If loCurrentPaymentScheduleBO.Seek(strSeekWhere) Then&lt;br&gt;
&lt;br&gt;
    Continue For&lt;br&gt;
&lt;br&gt;
End If&lt;br&gt;
[/codesnippet]&lt;br&gt;</description><pubDate>Thu, 05 Jun 2008 18:38:05 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item></channel></rss>