﻿<?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 / Business Objects and Data Access (How do I?)  / How do I fill an MRU list? / Latest Posts</title><generator>InstantForum.NET v4.1.4</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>forum@strataframe.net</webMaster><lastBuildDate>Wed, 07 Jan 2009 17:55:04 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: How do I fill an MRU list?</title><link>http://forum.strataframe.net/Topic17583-6-1.aspx</link><description>Cool :cool:</description><pubDate>Thu, 03 Jul 2008 11:02:59 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: How do I fill an MRU list?</title><link>http://forum.strataframe.net/Topic17583-6-1.aspx</link><description>Excellent!  That tip just cut my code in half.  Lean and mean!  :D&lt;/P&gt;&lt;P&gt;Thanks!&lt;BR&gt;Bill</description><pubDate>Thu, 03 Jul 2008 11:00:31 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: How do I fill an MRU list?</title><link>http://forum.strataframe.net/Topic17583-6-1.aspx</link><description>Actually, you really never need to create a connection object.  You could reduce your code by just talking straight to the DAL itself:&lt;P&gt;[codesnippet]//-- Establish Locals&lt;BR&gt;SqlCommand cmd;&lt;BR&gt;DataTable results;&lt;/P&gt;&lt;P&gt;//-- Create the command&lt;BR&gt;cmd = new SqlCommand("SELECT DISTINCT partdesc FROM PartsMaster WHERE divisionindex = @division AND inactive = 0 ORDER BY partdesc");&lt;/P&gt;&lt;P&gt;//-- Create the parms&lt;BR&gt;cmd.Parameters.AddWithValue("@division", mADUser.LocationIndex).SqlDbType = System.Data.SqlDbType.Int;&lt;/P&gt;&lt;P&gt;//-- Execute the query and get the results&lt;BR&gt;results = MicroFour.StrataFrame.Data.DataBasics.DataSources[""].GetDataTable(cmd, Nothing);&lt;/P&gt;&lt;P&gt;//-- Now cycle through and populate the combo&lt;BR&gt;foreach (DataRow row in results.Rows)&lt;BR&gt;{&lt;BR&gt;    //-- populate the combo with the row...&lt;BR&gt;}[/codesnippet]</description><pubDate>Thu, 03 Jul 2008 09:58:55 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: How do I fill an MRU list?</title><link>http://forum.strataframe.net/Topic17583-6-1.aspx</link><description>Nice approach.  I'll have to digest some of the details a bit.  &lt;/P&gt;&lt;P&gt;I only have the one textbox that I have been asked to supply a MRU-type list.  The users wanted to pick from all of the decriptions that are on file so that they can be consistent in their naming.  What I have provided on this one control works; however, it just seems clumsy to me.  Well, I may re-approach this topic if other users start requesting the same thing.&lt;/P&gt;&lt;P&gt;Two last thoughts...1)  Could my code be streamlined any?  I am not that great at manipulating datasets and collections; and, 2)  I'd like to refill this list whenever a record is added/deleted/changed.  Code I put the code in the AfterSave() method and it would work for all three operations?&lt;/P&gt;&lt;P&gt;Thanks a ton!&lt;BR&gt;Bill</description><pubDate>Thu, 03 Jul 2008 09:44:24 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: How do I fill an MRU list?</title><link>http://forum.strataframe.net/Topic17583-6-1.aspx</link><description>Glad you got it...we take an entirely different approach to MRUs within our applications.  Depending upon where and what are are doing, we may use a combo.  But in other cases we use a ListView on a "Getting Started" page.  But this really isn't my point on th topic...we actually serialize and store the MRU information on a per user basis in the SQL database itself.  This way when a user goes from one machine to the next, their MRUs are still there.  Additionaly, we have a single column to query for the user and object state type.  We have a MRU base class that we inherit and create for each type of MRU that may need to be created (i.e. patients, codes, templates, etc.)  We then serialize the MRU collection to a VarBinary field in an ObjectStates table.  So when a user gets to a certain combo/list/whatever, the MRU specifically for them is retrieved and the populates the object in question from the serialized object model.  These are just some ideas I thought I would throw out there since you brought up an MRU...this has been a huge hit...especially since it is by user and not specific to a machine.</description><pubDate>Thu, 03 Jul 2008 09:28:33 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: How do I fill an MRU list?</title><link>http://forum.strataframe.net/Topic17583-6-1.aspx</link><description>I got the sort issue sorted out. :)&lt;/P&gt;&lt;P&gt;On the control set the Properties.Sorted = true.  Not sure why that is necessary, but it works.</description><pubDate>Thu, 03 Jul 2008 08:29:27 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>How do I fill an MRU list?</title><link>http://forum.strataframe.net/Topic17583-6-1.aspx</link><description>I have dropped a DevEx MRUEdit control onto a form for the first time.  Cool little control.  I want to fill this thing with a distinct list of part descriptions.  Here is my working code for your review:&lt;/P&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;private&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;void&lt;/FONT&gt;&lt;FONT size=2&gt; FillPartDescriptionMRU()&lt;BR&gt;{&lt;BR&gt;    &lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;// get the distinct list of part descriptions&lt;BR&gt;    &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;SqlConnection&lt;/FONT&gt;&lt;FONT size=2&gt; cn = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;SqlConnection&lt;/FONT&gt;&lt;FONT size=2&gt;(MicroFour.StrataFrame.Data.&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;DataLayer&lt;/FONT&gt;&lt;FONT size=2&gt;.DataSources[&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"Aspire"&lt;/FONT&gt;&lt;FONT size=2&gt;].ConnectionString);&lt;BR&gt;    &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;SqlCommand&lt;/FONT&gt;&lt;FONT size=2&gt; cmd = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;SqlCommand&lt;/FONT&gt;&lt;FONT size=2&gt;();&lt;BR&gt;    cmd.Connection = cn;&lt;BR&gt;    cmd.CommandType = &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;CommandType&lt;/FONT&gt;&lt;FONT size=2&gt;.Text;&lt;BR&gt;    &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;ADUserBO&lt;/FONT&gt;&lt;FONT size=2&gt; mADUser = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;ADUserBO&lt;/FONT&gt;&lt;FONT size=2&gt;();&lt;BR&gt;    &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;SqlParameter&lt;/FONT&gt;&lt;FONT size=2&gt; pDiv = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;SqlParameter&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"@division"&lt;/FONT&gt;&lt;FONT size=2&gt;, mADUser.LocationIndex);&lt;BR&gt;    cmd.Parameters.Add(pDiv);&lt;BR&gt;    cmd.CommandText = &lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"SELECT DISTINCT partdesc FROM PartsMaster WHERE (divisionindex = @division) AND (inactive = 0) ORDER BY partdesc"&lt;/FONT&gt;&lt;FONT size=2&gt;;&lt;BR&gt;    &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;SqlDataAdapter&lt;/FONT&gt;&lt;FONT size=2&gt; sda = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;SqlDataAdapter&lt;/FONT&gt;&lt;FONT size=2&gt;(cmd);&lt;BR&gt;    &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;DataSet&lt;/FONT&gt;&lt;FONT size=2&gt; ds = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;DataSet&lt;/FONT&gt;&lt;FONT size=2&gt;();&lt;BR&gt;    sda.Fill(ds);&lt;BR&gt;    &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;foreach&lt;/FONT&gt;&lt;FONT size=2&gt; (&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;DataRow&lt;/FONT&gt;&lt;FONT size=2&gt; dr &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;in&lt;/FONT&gt;&lt;FONT size=2&gt; ds.Tables[0].Rows)&lt;BR&gt;    {&lt;BR&gt;        txtPartDesc.Properties.Items.Add((&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;FONT size=2&gt;)dr[0]);&lt;BR&gt;    }&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;Is this the best way to approach a distinct list of strings from my database in order to fill my MRU list?  I do have a PartsBO...is there a way to get these strings from the BO?  Also, the list is filled in descending alphabetical order, even though I have specified an ASC sort in the query.  Is there a reason why my sort is backwards?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;Thanks for any help on this!!&lt;BR&gt;Bill&lt;/P&gt;&lt;/FONT&gt;</description><pubDate>Thu, 03 Jul 2008 08:15:18 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item></channel></rss>