<?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>Rakesh Rajan's blog : ASP.NET</title><link>http://msmvps.com/blogs/rakeshrajan/archive/tags/ASP.NET/default.aspx</link><description>Tags: ASP.NET</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>System.Data.OleDb.OleDbException: Unspecified error</title><link>http://msmvps.com/blogs/rakeshrajan/archive/2005/07/04/56461.aspx</link><pubDate>Mon, 04 Jul 2005 20:04:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:56461</guid><dc:creator>rakeshrajan</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/rakeshrajan/rsscomments.aspx?PostID=56461</wfw:commentRss><comments>http://msmvps.com/blogs/rakeshrajan/archive/2005/07/04/56461.aspx#comments</comments><description>&lt;DIV class=blogBody&gt;
&lt;P&gt;&lt;SPAN class=codeSnippet&gt;System.Data.OleDb.OleDbException: Unspecified error&lt;/SPAN&gt; while calling the &lt;CODE&gt;Connection.Open&lt;/CODE&gt; method on an Access or Excel file within ASP.NET. This is an issue you could face while opening Excel or Access files as data sources in ASP.NET using OleDb Jet.&lt;/P&gt;
&lt;P&gt;
&lt;H3&gt;Cause Number 1&lt;/H3&gt;ASP.NET/Impersonated account doesn&amp;#8217;t have enough privileges to create the ldb file. &lt;BR&gt;&lt;BR&gt;&lt;B&gt;Resolution &lt;/B&gt;Give the ASP.NET user account create/write privileges to the folder where the excel/access file is placed. If you are using impersonation, give the impersonated account the said privileges. 
&lt;P&gt;&lt;BR&gt;&lt;/P&gt;&lt;BR&gt;
&lt;P&gt;
&lt;H3&gt;Cause Number 2 &lt;/H3&gt;Impersonated account doesn&amp;#8217;t have enough privileges to create temporary files. &lt;BR&gt;&lt;BR&gt;&lt;B&gt;Description &lt;/B&gt;When you open excel or access files using Jet, it requires creation of temporary files. Under ASP.NET, these files will be created under the &lt;SPAN class=codeSnippet&gt;C:\Documents and Settings\MachineName\ASPNET\Local Settings\Temp folder&lt;/SPAN&gt;. By default, the ASP.NET user account is given full access to this folder. Now, when you are using impersonation, the impersonated account naturally wouldn&amp;#8217;t have access to this folder. Consequently, the Jet engine wouldn&amp;#8217;t be able to create the temporarily files while opening connections to excel or access files under ASP.NET. Due to this, the OleDb provider throws an exception with no specific message - &lt;SPAN class=codeSnippet&gt;System.Data.OleDb.OleDbException: Unspecified error.&lt;/SPAN&gt; &lt;BR&gt;&lt;BR&gt;&lt;B&gt;Resolution &lt;/B&gt;Give the impersonated account full access to the above mentioned folder. &lt;BR&gt;Check out the Microsoft support article &lt;A href="http://support.microsoft.com/default.aspx?scid=kb;EN-US;825738"&gt;here&lt;/A&gt;[&lt;A href="http://support.microsoft.com/default.aspx?scid=kb;EN-US;825738" target=_blank&gt;^&lt;/A&gt;] 
&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=56461" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/rakeshrajan/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>Just posted my first ASP.NET article!</title><link>http://msmvps.com/blogs/rakeshrajan/archive/2005/06/05/50543.aspx</link><pubDate>Mon, 06 Jun 2005 01:26:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:50543</guid><dc:creator>rakeshrajan</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/rakeshrajan/rsscomments.aspx?PostID=50543</wfw:commentRss><comments>http://msmvps.com/blogs/rakeshrajan/archive/2005/06/05/50543.aspx#comments</comments><description>									&lt;p&gt;
										I just posted my first ever &lt;a href="http://www.codeproject.com/aspnet/ErrorHandlingASPNET.asp" target="_blank"&gt;
											ASP.NET article&lt;/a&gt; :)
									&lt;p&gt;
										That too, after a significant time!
									&lt;/p&gt;
									&lt;p&gt;
										Hmm...I should write more frequently...
									&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=50543" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/rakeshrajan/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>Data binding syntaxes</title><link>http://msmvps.com/blogs/rakeshrajan/archive/2005/04/10/41485.aspx</link><pubDate>Sun, 10 Apr 2005 21:05:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:41485</guid><dc:creator>rakeshrajan</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/rakeshrajan/rsscomments.aspx?PostID=41485</wfw:commentRss><comments>http://msmvps.com/blogs/rakeshrajan/archive/2005/04/10/41485.aspx#comments</comments><description>								&lt;p&gt;
									&lt;strong&gt;Background&lt;/strong&gt;&lt;br /&gt; DataBinder.Eval and the standard explicit casting of 
									&lt;span class="codeSnippet"&gt;Container.DataItem&lt;/span&gt; are the two syntaxes you could use while performing data 
									binding.&amp;nbsp; Some developers are stringent on performance (they use only the 
									standard syntax), some are concerned about maintenance (nothing but 
									&lt;span class="codeSnippet"&gt;DataBinder.Eval&lt;/span&gt;), while some are least bothered about the syntax they 
									use.&amp;nbsp; I have seen code filled with &lt;span class="codeSnippet"&gt;DataBinder.Eval&lt;/span&gt; where the standard 
									&lt;span class="codeSnippet"&gt;Container.DataItem&lt;/span&gt; syntax would have been a perfect fit.&amp;nbsp; So I thought I 
									would write a little bit on how to select the appropriate data binding syntax.
									&lt;hr id="null"&gt;
								&lt;/p&gt;
								&lt;p&gt;
									There are two data binding syntaxes you could employ when you use repeated 
									value data binding:
								&lt;/p&gt;
								&lt;ul&gt;
									&lt;li&gt;
										the standard syntax with explicit casting of &lt;span class="codeSnippet"&gt;Container.DataItem&lt;/span&gt;
									&lt;/li&gt;
									&lt;li&gt;
										the &lt;span class="codeSnippet"&gt;DataBinder.Eval&lt;/span&gt; syntax&lt;/li&gt;
								&lt;/ul&gt;
								&lt;p&gt;
									The following two expressions perform the same binding (they both bind to the 
									'City' column of the current data item), but uses the different syntaxes 
									mentioned above.&lt;/p&gt;
								&lt;ol&gt;
									&lt;li&gt;
										&amp;lt;%# ((DataRowView)Container.DataItem)["City"] %&amp;gt;
									&lt;/li&gt;
									&lt;li&gt;
										&amp;lt;%# DataBinder.Eval(Container.DataItem, "City") %&amp;gt;&lt;/li&gt;
								&lt;/ol&gt;
								&lt;p&gt;
									The problem with the first syntax (the standard data binding syntax) is that if 
									the data source changes, we need to change the cast too.&amp;nbsp; Say, if the data 
									source in the above example changes to a data reader, then we need to change 
									the syntax to:&lt;/p&gt;
								&lt;p&gt;
									&amp;lt;%# ((DbDataRecord)Container.DataItem)["City"] %&amp;gt;&lt;/p&gt;
								&lt;p&gt;
									In other words, the standard data binding syntax is 'strongly typed'.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
								&lt;p&gt;
									&lt;br&gt;
									&lt;span class="codeSnippet"&gt;DataBinder.Eval&lt;/span&gt; was provided as a helper method to simplify the standard data 
									binding syntax.&amp;nbsp; Instead of you specifying the syntax (with the data item 
									type etc.), &lt;span class="codeSnippet"&gt;DataBinder.Eval&lt;/span&gt; figures out the syntax on its own and in addition, 
									formats the result and returns a string.
								&lt;/p&gt;
								&lt;p&gt;
									The bad thing about &lt;span class="codeSnippet"&gt;DataBinder.Eval&lt;/span&gt; is that since it uses late-bound 
									reflection to figure out the data types of the source specified, it comes with 
									a performance hit.
								&lt;/p&gt;
								&lt;p&gt;
									So how do we decide which data binding syntax to use?&lt;/p&gt;
								&lt;p&gt;
									Use &lt;span class="codeSnippet"&gt;DataBinder.Eval&lt;/span&gt; if...&lt;/p&gt;
								&lt;ul&gt;
									&lt;li&gt;
										You are into control development.&amp;nbsp; When you develop controls, you are not 
										sure what kind of data source types your control is going to be bound to.&amp;nbsp; 
										Moreover, you also wouldn't like to force your clients to use a specific data 
										source type.
									&lt;/li&gt;
									&lt;li&gt;
										You don't mind a performance hit.
									&lt;/li&gt;
									&lt;li&gt;
										You are too lazy to go to every page and change the standard syntax whenever 
										the data source type changes :)
											&lt;/li&gt;
								&lt;/ul&gt;
								&lt;p&gt;
									Use the standard syntax if...&lt;/p&gt;
								&lt;ul&gt;
									&lt;li&gt;
										You want to squeeze every bit of performance out of your pages.
									&lt;/li&gt;
									&lt;li&gt;
										You know what the data source type of a control is, and you are also sure that 
										the data source type won't change
									&lt;/li&gt;
									&lt;li&gt;
										You don't mind doing a &lt;span class="codeSnippet"&gt;CStr&lt;/span&gt; or a &lt;span class="codeSnippet"&gt;ToString&lt;/span&gt; wherever required&lt;br&gt;
									&lt;/li&gt;
								&lt;/ul&gt;
								&lt;p&gt;
									Both approaches have their own good and bad sides.&amp;nbsp; I hope the points 
									above would help you decide on which one to select.
								&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=41485" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/rakeshrajan/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item></channel></rss>