<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Cluebat-man to the rescue : Access</title><link>http://msmvps.com/blogs/vandooren/archive/tags/Access/default.aspx</link><description>Tags: Access</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>Access != database</title><link>http://msmvps.com/blogs/vandooren/archive/2008/07/14/access-database.aspx</link><pubDate>Mon, 14 Jul 2008 06:27:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1640689</guid><dc:creator>vanDooren</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/vandooren/rsscomments.aspx?PostID=1640689</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/vandooren/commentapi.aspx?PostID=1640689</wfw:comment><comments>http://msmvps.com/blogs/vandooren/archive/2008/07/14/access-database.aspx#comments</comments><description>&lt;p style="margin:0cm 0cm 12pt;" class="MsoNormal"&gt;&lt;span style="font-size:small;font-family:Times New Roman;"&gt;While working on a data application for the finance guys, I already discovered that Excel sucks when used with OleDb. It seems as if Excel was specifically &lt;i style="mso-bidi-font-style:normal;"&gt;designed&lt;/i&gt; to make your life as a programmer miserable.&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0cm 0cm 12pt;" class="MsoNormal"&gt;&lt;span style="font-size:small;font-family:Times New Roman;"&gt;Fair&amp;rsquo;s fair: Excel is not a database, so perhaps it is acceptable if the data link layer feels as if it has been thrown together by a vba hacker without a clear grasp of data types and interfaces. Probably they needed another handful of buzzwords on the Excel box, and decided to hire a high-school summer intern who installed basic once.&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0cm 0cm 12pt;" class="MsoNormal"&gt;&lt;span style="font-size:small;font-family:Times New Roman;"&gt;But I digress.&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0cm 0cm 12pt;" class="MsoNormal"&gt;&lt;span style="font-size:small;font-family:Times New Roman;"&gt;While I am willing to let Excel off the hook for not being something it was not supposed to be, I have a problem with extending the same courtesy to Access; an application specifically designed to be a database.&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0cm 0cm 12pt;" class="MsoNormal"&gt;&lt;span style="font-size:small;font-family:Times New Roman;"&gt;For the last couple of hours I have been debugging the finance app because some of the allocated items showed up as having cost nothing. This would have enjoyed the CFO immensely if it had been true, but since that wasn&amp;rsquo;t the case, they were wondering why my app insisted it. &lt;/span&gt;&lt;span style="font-size:small;font-family:Times New Roman;"&gt;For some systems the totals and the details were correct. For others they were zero, or something far less that what they had cost in reality.&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0cm 0cm 12pt;" class="MsoNormal"&gt;&lt;span style="font-size:small;font-family:Times New Roman;"&gt;I examined a correct example, compared it with one of the problem cases, and found that all required data was there, in the correct tables. Then I debugged through the code, and the algorithm seemed to work just fine. Only for some systems it didn&amp;rsquo;t return any values. And since this was done via LINQ, debugging the actual SQL was difficult.&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0cm 0cm 12pt;" class="MsoNormal"&gt;&lt;span style="font-size:small;font-family:Times New Roman;"&gt;Then I decided to go spelunking in the raw data tables themselves. Again and again I checked, and nothing seemed to be wrong. But then it suddenly jumped at me:&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0cm 0cm 12pt;" class="MsoNormal"&gt;&lt;span style="font-size:small;font-family:Times New Roman;"&gt;tbl_keymstr -&amp;gt; row 1234 -&amp;gt; Alloc_key == &amp;lsquo;all&amp;rsquo;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0cm 0cm 12pt;" class="MsoNormal"&gt;&lt;span style="font-size:small;font-family:Times New Roman;"&gt;tbl_alloc -&amp;gt; row 123456 -&amp;gt; Alloc_key == &amp;lsquo;All&amp;rsquo;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0cm 0cm 12pt;" class="MsoNormal"&gt;&lt;span style="font-size:small;font-family:Times New Roman;"&gt;How could this be possible? I double checked, and verified that the links were all defined with the &amp;lsquo;Enforce referential integrity&amp;rsquo; flag set.&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0cm 0cm 12pt;" class="MsoNormal"&gt;&lt;span style="font-size:small;font-family:Times New Roman;"&gt;After some testing, it seems that Access is pretty loose in its judgments. When it comes to comparing strings, &amp;lsquo;equals&amp;rsquo; really means &amp;lsquo;kinda looks like&amp;rsquo;, so &amp;lsquo;All&amp;rsquo;, &amp;lsquo;all&amp;rsquo; and &amp;lsquo;alL&amp;rsquo; are all the same for access.&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0cm 0cm 12pt;" class="MsoNormal"&gt;&lt;span style="font-size:small;font-family:Times New Roman;"&gt;The LINQ queries in my app all use the C# &amp;lsquo;==&amp;rsquo; to define joinings and equality operations, so if the rows in 1 table say &amp;lsquo;All&amp;rsquo; and those in the other say &amp;lsquo;all&amp;rsquo; the result of the joined set is empty of course.&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0cm 0cm 12pt;" class="MsoNormal"&gt;&lt;span style="font-size:small;font-family:Times New Roman;"&gt;Key definitions and cost allocations get uploaded separately, and my app doesn&amp;rsquo;t check whether the key fields are spelled the same. Everything gets uploaded, and the integrity is insured by the database itself, as it should be. If there is an upload error it gets reported and everything is rolled back. Unfortunately, key value comparison does not work that well.&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0cm 0cm 12pt;" class="MsoNormal"&gt;&lt;span style="font-size:small;font-family:Times New Roman;"&gt;The fix was very simple: I implemented a case insensitive comparison in my queries, and the problem was solved. Too bad Access is allowed by the Office team to&amp;nbsp;let sloppy input through.&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0cm 0cm 12pt;" class="MsoNormal"&gt;&lt;span style="font-size:small;font-family:Times New Roman;"&gt;&lt;strong&gt;EDIT: I just checked, and by default, SQL server has the same behavior. But you can change it to case sensitive if you want, which is important in scenarios like these. Granted, I should have checked first before slagging off Access, but I still think that this should be an option in Access&lt;/strong&gt;. &lt;strong&gt;The fact that it isn&amp;#39;t is a severe shortcoming in my eyes, since lots of smaller databases use strings as keys.&amp;nbsp;In case sensitive clients (like e.g. C# apps by default) this causes a lot of work to get correct results. And if you forget to case insensitivize (is that even a word?) your queries even once, you will get incorrect data.&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1640689" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/vandooren/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://msmvps.com/blogs/vandooren/archive/tags/OleDb/default.aspx">OleDb</category><category domain="http://msmvps.com/blogs/vandooren/archive/tags/Access/default.aspx">Access</category></item></channel></rss>