﻿<?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 » WinForms (How do I?)  » Save after edit gives broken rules on unchanged text</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 15:41:23 GMT</lastBuildDate><ttl>20</ttl><item><title>Save after edit gives broken rules on unchanged text</title><link>http://forum.strataframe.net/FindPost1636.aspx</link><description>I have a user control which is basically like the maintenance tool strip.&amp;nbsp; It has&amp;nbsp;save, new, delete, edit, and undo buttons which function on a business object and linked to controls on the form.&amp;nbsp; I have some business rules setup which prevent duplicate names from being entered into the database.&amp;nbsp; This works perfectly when doing a New operation and saving.&amp;nbsp; However, if I edit a record and then try to save it will give me a broken rule for things that haven't changed.&amp;nbsp; For example, I have a FirstName and a LastName field.&amp;nbsp; I want to only edit the FirstName, but leave the LastName alone.&amp;nbsp; If I do this, and then save it will give me a broken rule on LastName if I'm not allowing duplicates.&amp;nbsp; Is there some way around this?&amp;nbsp; Maybe a setting that tells the BO not to check rules on fields that haven't changed from their original state?</description><pubDate>Thu, 22 Jun 2006 11:38:33 GMT</pubDate><dc:creator>Andria Jensen</dc:creator></item><item><title>RE: Save after edit gives broken rules on unchanged text</title><link>http://forum.strataframe.net/FindPost1644.aspx</link><description>Good.&amp;nbsp; Glad to help :)</description><pubDate>Thu, 22 Jun 2006 11:38:33 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Save after edit gives broken rules on unchanged text</title><link>http://forum.strataframe.net/FindPost1641.aspx</link><description>Thanks, that works great!</description><pubDate>Thu, 22 Jun 2006 11:24:11 GMT</pubDate><dc:creator>Andria Jensen</dc:creator></item><item><title>RE: Save after edit gives broken rules on unchanged text</title><link>http://forum.strataframe.net/FindPost1637.aspx</link><description>Andria,&lt;P&gt;Your business rule needs to exclude the record your are working on.&amp;nbsp; The best way to do this is include the primary key as part of the test.&amp;nbsp; This will work for new or existing records.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;'-- Establish Locals&lt;BR&gt;Dim loCommand As New SqlCommand()&lt;/P&gt;&lt;P&gt;'-- Build the command&lt;BR&gt;loCommand.CommandText = "SELECT COUNT(*) FROM MyTable WHERE mt_pk != @mt_pk AND mt_lastname = @mt_lastname"&lt;/P&gt;&lt;P&gt;'-- Add the parms&lt;BR&gt;loCommand.Parameters.Add("@mt_pk", Data.SqlDbType.Int)&lt;BR&gt;loCommand.Parameters.Add("@mt_lastname", Data.SqlDbType.VarChar)&lt;/P&gt;&lt;P&gt;'-- Set the parms&lt;BR&gt;loCommand.Parameters("@mt_pk").Value = PassedPrimaryKey&lt;BR&gt;loCommand.Parameters("@mt_lastname").Value = PassedLastName&lt;BR&gt;&lt;BR&gt;'-- Return Boolean Results&lt;BR&gt;Return CType(Me.ExecuteScalar(loCommand), Integer) &amp;gt; 0</description><pubDate>Thu, 22 Jun 2006 10:49:40 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item></channel></rss>