Matt Pavey's Blog [RSS] http://www.pavey.net Matt Pavey's blog with information about web technologies such as .Net, ASP.Net, VB.Net, C#, AJAX, LINQ, XML, XSL, WCF Services, Web Services, SQL Server, SSIS, T-SQL, stored procedures and more. en-us Copyright © 2010 Matt Pavey 9/9/2010 1:05:27 PM 9/9/2010 1:05:27 PM http://www.pavey.net Matt Pavey mpavey@gmail.com mpavey@gmail.com 5 http://www.pavey.net/Uploads/VforVendetta.jpg Unrecognized element 'extendedProtectionPolicy'http://www.pavey.net/?BlogID=501<em>"... it appears this is caused by the usage of multiple platforms. It appears that the configuration is only created when consuming the service on my Windows 7 development box, but then not recognized by other platforms such as Windows Server 2003... However due to its staged rollout, it is not fully supported and hence the above errors are generated."</em> <p><em>"The fix? Simple for the time being. Just remove the tag and redeploy the configuration."</em></p> <a href="http://allen-conway-dotnet.blogspot.com/2010/03/dealing-with-unrecognized-element.html" target="_blank">http://allen-conway-dotnet.blogspot.com/2010/03/dealing-with-unrecognized-element.html</a>Matt PaveyWCFhttp://www.pavey.net/?BlogID=5012010-08-12 15:40:47HTTP Error 404.17 on Windows 7 64-bit IIS7http://www.pavey.net/?BlogID=500<div>Ran into a problem today where I was getting <strong>HTTP Error 404.17</strong> after setting up Windows 7 64-bit with IIS7.</div> <p><em>"HTTP Error 404.17 - Not Found - The requested content appears to be script and will not be served by the static file handler."</em> </p> <p>The ISAPI DLL is a 32-bit DLL, so you'll have to either change your default Application Pool to enable 32-bit, or create a separate 32-bit AppPool for your application.</p> <p>To <strong>Enable 32-bit Applications</strong> right click on the Application Pool and select "Advanced Settings" then "Enable 32-bit Applications."</p> <p>Thanks to Scott Hanselman for sharing his solution.</p> <a href=http://www.hanselman.com/blog/HTTPError40417PHPOnIIS7Under64bitVista.aspx target="_blank">http://www.hanselman.com/blog/HTTPError40417PHPOnIIS7Under64bitVista.aspx</a> <div></div>Matt PaveyIIShttp://www.pavey.net/?BlogID=5002010-07-27 10:59:25VisualSVN the requested operation cannot be performed on a file with a user-mapped section openhttp://www.pavey.net/?BlogID=499<a href=http://blogs.planetcloud.co.uk/mygreatdiscovery/post/VisualSVN-the-requested-operation-cannot-be-performed-on-a-file-with-a-user-mapped-section-open.aspx target="_blank">http://blogs.planetcloud.co.uk/mygreatdiscovery/post/VisualSVN-the-requested-operation-cannot-be-performed-on-a-file-with-a-user-mapped-section-open.aspx</a>Matt PaveyOtherhttp://www.pavey.net/?BlogID=4992010-06-19 13:08:07LINQ Select Distincthttp://www.pavey.net/?BlogID=498<font color="#000000" face="Verdana">Dim x As IEnumerable(Of Integer) = From o In Orders From d In o.Details Select d.ProductID Distinct</font>Matt PaveyLINQhttp://www.pavey.net/?BlogID=4982010-06-08 17:28:03How to add mime types with IIS7http://www.pavey.net/?BlogID=497<div><a href=http://blogs.iis.net/bills/archive/2008/03/25/how-to-add-mime-types-with-iis7-web-config.aspx target="_blank">http://blogs.iis.net/bills/archive/2008/03/25/how-to-add-mime-types-with-iis7-web-config.aspx</a></div>Matt PaveyIIShttp://www.pavey.net/?BlogID=4972010-06-08 16:29:39Configure Support for Unhandled Exceptions in WCF serviceshttp://www.pavey.net/?BlogID=496<div><font color="#000000" face="Verdana"><em>"By default, WCF services do not return information from unhandled exceptions to protect sensitive data. Exception data contains low-level information about the implementation of a service that can be used by attackers to compromise a Web service. During development, it is often necessary to view this information to troubleshoot issues with the service. As a result, WCF provides the ability to configure a service to return information from unhandled exceptions."</em></font></div> <div>&nbsp;</div> <div><a href="http://msdn.microsoft.com/en-us/library/ff649234.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/ff649234.aspx</a></div>Matt PaveyWCFhttp://www.pavey.net/?BlogID=4962010-05-24 17:36:04Capturing mouse position with JavaScripthttp://www.pavey.net/?BlogID=495<div>I had an issue today where I needed to capture the (x, y) coordinates of the user's mouse when they clicked on various links in a grid. The original code was using the clientX and clientY event properties to determine the coordinates, which seemed to work well; however, when the grid contained several more rows of data the page required scrolling and the clientX and clientY values were no longer relative to the position of the page.</div> <div>&nbsp;</div> <div>Google had quite&nbsp; few articles on the topic, but the one I ended up finding the most useful was:</div> <div>&nbsp;</div> <div><a href="http://www.quirksmode.org/js/events_properties.html" target="_blank">http://www.quirksmode.org/js/events_properties.html</a></div> <div>&nbsp;</div> <div>The code I ended up using in my scenario was:</div> <div><br /> <font size="1">// determine x,y coordinates of mouse position relative to document<br /> var clientX = 0;<br /> var clientY = 0;</div> <div> <p>if (!e) var e = window.event;<br /> &nbsp;&nbsp;&nbsp; <br /> if (e.pageX || e.pageY) {<br /> &nbsp;&nbsp; clientX = e.pageX;<br /> &nbsp;&nbsp; clientY = e.pageY;<br /> }<br /> else if (e.clientX || e.clientY) {<br /> &nbsp;&nbsp; clientX = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;<br /> &nbsp;&nbsp; clientY = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;<br /> }</p> </div> </font>Matt PaveyJavaScripthttp://www.pavey.net/?BlogID=4952010-05-05 14:06:00Configure SQL Server Agent Mail to Use Database Mailhttp://www.pavey.net/?BlogID=494<div>I had an issue this morning when email notifications were not working for a SQL Server Agent Job. I found this entry in the error logs:</div> <div>&nbsp;</div> <div><em>[264] An attempt was made to send an email when no email session has been established</em></div> <div>&nbsp;</div> <div>A quick Google search led me to this article:</div> <div>&nbsp;</div> <div> <div><a href="http://msdn.microsoft.com/en-us/library/ms186358(SQL.90).aspx" target="_blank">http://msdn.microsoft.com/en-us/library/ms186358(SQL.90).aspx</a></div> </div> <div>&nbsp;</div> <div>To set up SQL Server Agent Mail to use Database Mail</div> <ol> <li> <p>In Object Explorer, expand a server.</p> <li> <p>Right-click <strong>SQL Server Agent</strong>, and then click <strong>Properties</strong>.</p> <li> <p>Click <strong>Alert System</strong>.</p> <li> <p>Select <strong>Enable Mail Profile</strong>.</p> <li> <p>In the <strong>Mail system</strong> list, select <strong>Database Mail</strong>.</p> <li> <p>In the <strong>Mail profile list</strong>, select a mail profile for Database Mail.</p> <li> <p>Restart SQL Server Agent.</p> </li> </ol> <p>Following these steps and configuring the mail profile accordingly allowed me to be able to successfully send the email notifications.</p>Matt PaveySQL Serverhttp://www.pavey.net/?BlogID=4942010-05-04 08:48:49Javascript String Contains Functionhttp://www.pavey.net/?BlogID=493String.prototype.contains = <font color="#0000ff">function</font>(value) { <font color="#0000ff">return</font> <font color="#0000ff">this</font>.indexOf(value) != -1; };Matt PaveyJavaScripthttp://www.pavey.net/?BlogID=4932010-05-03 22:40:04Outlook 2007 Favorite Folders disappearedhttp://www.pavey.net/?BlogID=492<div>I ran into an issue today where someone's Outlook 2007 lost the <strong>Favorite Folders</strong> in the navigation pane.</div> <div>&nbsp;</div> <div>The obvious place to go to try showing it again was <strong>View</strong> - <strong>Navigation Pane</strong> but to my surprise <strong>Favorite Folders</strong> was no longer listed.</div> <div>&nbsp;</div> <div>After some digging around on Google I came across this article, which lead me to a solution that worked for this particular situation (Outlook 2007, Windows 7).</div> <div>&nbsp;</div> <div><a href="http://blog.palehorse.net/2007/09/26/outlook-ate-my-favorite-shortcuts/" target="_blank">http://blog.palehorse.net/2007/09/26/outlook-ate-my-favorite-shortcuts/</a></div> <div>&nbsp;</div> <div>Specifically what action I took was:</div> <div>&nbsp;</div> <div>- Close Outlook</div> <div>- Go to the command prompt</div> <div>- Browse to <strong>C:\Program Files\Microsoft Office\Office12<br /> </strong>- Execute&nbsp;<strong>OUTLOOK.EXE /resetnavpane<br /> </strong>- Open Outlook<br /> - Go to <strong>View</strong> - <strong>Navigation Pane</strong> and check <strong>Favorite Folders</strong></div> <div>&nbsp;</div> <div>Here's a a good website that describes the available command line switches for Outlook.</div> <div>&nbsp;</div> <div><a href="http://www.outlook-tips.net/howto/commandlines.htm" target="_blank">http://www.outlook-tips.net/howto/commandlines.htm</a></div>Matt PaveyOfficehttp://www.pavey.net/?BlogID=4922010-05-03 20:14:00jQuery UIhttp://www.pavey.net/?BlogID=491<div><em>"jQuery UI provides a comprehensive set of core interaction plugins, UI widgets and visual effects that use a jQuery-style, event-driven architecture and a focus on web standards, accessiblity, flexible styling, and user-friendly design."</em></div> <div>&nbsp;</div> <div><a href=http://jqueryui.com/ target="_blank">http://jqueryui.com/</a></div><div>&nbsp;</div> <div><em>"ThemeRoller allows you to design custom jQuery UI themes for tight integration in your projects. To create a custom theme, select the Roll your own tab and tweak the settings. As you work, the UI components to the right will update to reflect your design and you can download your theme whenever you like."</em></div> <div>&nbsp;</div> <div><a href=http://jqueryui.com/themeroller/ target="_blank">http://jqueryui.com/themeroller/</a></div>Matt PaveyjQueryhttp://www.pavey.net/?BlogID=4912010-05-03 20:01:19jQuery Flyout Menuhttp://www.pavey.net/?BlogID=490<div>Here's a good website showing how to incorporte a jQuery flyout menu into your website.</div> <div>&nbsp;</div> <div><a href="http://www.filamentgroup.com/lab/jquery_ipod_style_and_flyout_menus/" target="_blank">http://www.filamentgroup.com/lab/jquery_ipod_style_and_flyout_menus/</a></div> <div>&nbsp;</div> <div>It doesn't look like it's still actively being maintained by this group, but I still thought it was worth bookmarking in order to follow its progress as it potentially becomes incorporated into the jQuery UI.</div>Matt PaveyjQueryhttp://www.pavey.net/?BlogID=4902010-05-03 19:55:01Display local time from utc timehttp://www.pavey.net/?BlogID=489<a href=http://stackoverflow.com/questions/2263705/display-local-time-from-utc-time-stored-in-sql-database-on-asp-net-app target="_blank">http://stackoverflow.com/questions/2263705/display-local-time-from-utc-time-stored-in-sql-database-on-asp-net-app</a>Matt Pavey.Nethttp://www.pavey.net/?BlogID=4892010-04-23 20:22:39WCF on IIS7; Adding .svc handlerhttp://www.pavey.net/?BlogID=488<div><strong>HTTP Error 404.3 - Not Found</strong> <p><em>The page you are requesting cannot be served because of the extension of the configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.</em></p> </div> <ul> <li>Start the command window (cmd) <strong>as an Administrator</strong>. <li>C:\windows\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\ <li>Run the following command: <strong>ServiceModelReg &#8211;i</strong> </li> </ul> <p><a href="http://blogs.microsoft.co.il/blogs/bursteg/archive/2008/12/01/wcf-on-iis7-on-vista-adding-svc-handler.aspx" target="_blank">http://blogs.microsoft.co.il/blogs/bursteg/archive/2008/12/01/wcf-on-iis7-on-vista-adding-svc-handler.aspx</a></p>Matt PaveyWCFhttp://www.pavey.net/?BlogID=4882010-04-23 12:24:52Visual Studio 2010 and .NET 4 Releasedhttp://www.pavey.net/?BlogID=487<div>The final release of Visual Studio 2010 and .NET 4 is now available.</div> <div>&nbsp;</div> <div><font color="#000000" face="Verdana"><a href=http://weblogs.asp.net/scottgu/archive/2010/04/12/visual-studio-2010-and-net-4-released.aspx target="_blank">http://weblogs.asp.net/scottgu/archive/2010/04/12/visual-studio-2010-and-net-4-released.aspx</a></font></div>Matt Pavey.Nethttp://www.pavey.net/?BlogID=4872010-04-21 21:47:25Move/Scroll Page to Top After Asynchronous Postback in UpdatePanel in ASP.Net AJAXhttp://www.pavey.net/?BlogID=486<div><font color="#a31515" size="2"><font color="#a31515" size="2"><font color="#0000ff" size="2"><font color="#0000ff" size="2">&lt;</font></font>script</font></font><font size="2"> </font><font color="#ff0000" size="2"><font color="#ff0000" size="2">type</font></font><font color="#0000ff" size="2"><font color="#0000ff" size="2">="text/javascript"&gt;<br /> </font></font><font color="#0000ff" size="2"><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;function</font></font><font size="2"> pageLoad() {<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000ff" size="2"><font color="#0000ff" size="2">var</font></font><font size="2"> manager = Sys.WebForms.PageRequestManager.getInstance();<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;manager.add_endRequest(endRequest);<br /> &nbsp;&nbsp;&nbsp;}</font></div> <div>&nbsp;</div> <div><font color="#0000ff" size="2"><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;function</font></font><font size="2"> endRequest(sender, args) {<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;window.scrollTo(0, 0);<br /> &nbsp;&nbsp;&nbsp;}<br /> </font><font color="#0000ff" size="2"><font color="#0000ff" size="2">&lt;/</font></font><font color="#a31515" size="2"><font color="#a31515" size="2">script</font></font><font color="#0000ff" size="2"><font color="#0000ff" size="2">&gt;</div> <div></font></font>&nbsp;</div> <div><a href="http://www.codedigest.com/CodeDigest/120-Move-Scroll-Page-to-Top-After-Asynchronous-Postback-in-UpdatePanel-in-ASP-Net-AJAX.aspx" target="_blank">http://www.codedigest.com/CodeDigest/120-Move-Scroll-Page-to-Top-After-Asynchronous-Postback-in-UpdatePanel-in-ASP-Net-AJAX.aspx</a></div>Matt PaveyAJAXhttp://www.pavey.net/?BlogID=4862009-07-30 09:18:57New ASP.NET Charting Control: <asp:chart runat="server"/>http://www.pavey.net/?BlogID=485Another great article on <a href="http://weblogs.asp.net/scottgu/" target="_blank">ScottGu's Blog</a>. <p><em>Microsoft recently released a cool new ASP.NET server control - &lt;asp:chart /&gt; - that can be used for free with ASP.NET 3.5 to enable rich browser-based charting scenarios:</em></p> <ul> <li><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=130f7986-bf49-4fe5-9ca8-910ae6ea442c&amp;DisplayLang=en" target="_blank">Download the free Microsoft Chart Controls</a> <li><a href="http://www.microsoft.com/downloads/details.aspx?familyid=1D69CE13-E1E5-4315-825C-F14D33A303E9&amp;displaylang=en" target="_blank">Download the VS 2008 Tool Support for the Chart Controls</a> <li><a href="http://code.msdn.microsoft.com/mschart/Release/ProjectReleases.aspx?ReleaseId=1591" target="_blank">Download the Microsoft Chart Controls Samples</a> <li><a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=EE8F6F35-B087-4324-9DBA-6DD5E844FD9F&amp;displaylang=en" target="_blank">Download the Microsoft Chart Controls Documentation</a> <li><a href="http://social.msdn.microsoft.com/Forums/en-US/MSWinWebChart/threads/" target="_blank">Visit the Microsoft Chart Control Forum</a> </li> </ul> <p>Check out the article for more information on dowloading the free chart control, samples and documentation:</p> <p><a href="http://weblogs.asp.net/scottgu/archive/2008/11/24/new-asp-net-charting-control-lt-asp-chart-runat-quot-server-quot-gt.aspx" target="_blank">http://weblogs.asp.net/scottgu/archive/2008/11/24/new-asp-net-charting-control-lt-asp-chart-runat-quot-server-quot-gt.aspx</a></p> <em>"&lt;asp:chart /&gt; supports a rich assortment of chart options - including pie, area, range, point, circular, accumulation, data distribution, ajax interactive, doughnut, and more.&nbsp; You can statically declare chart data within the control declaration, or alternatively use data-binding to populate it dynamically.&nbsp; At runtime the server control generates an image (for example a .PNG file) that is referenced from the client HTML of the page using a &lt;img/&gt; element output by the &lt;asp:chart/&gt; control.&nbsp; The server control supports the ability to cache the chart image, as well as save it on disk for persistent scenarios.&nbsp; It does not require any other server software to be installed, and will work with any standard ASP.NET page."</em>Matt PaveyASP.Nethttp://www.pavey.net/?BlogID=4852009-01-22 09:17:03Hosting options for WCF serviceshttp://www.pavey.net/?BlogID=484<div><em>"These hosting options range from running inside a console application to server environments such as a Windows service running within a worker process managed by Internet Information Services (IIS) or by Windows Process Activation Service (WAS). Developers choose the hosting environment that satisfies the service's deployment requirements. These requirements might derive from the platform on which the application is deployed, the transport on which it must send and receive messages, or on the type of process recycling and other process management required to ensure adequate availability, or on some other management or reliability requirements."</em></div> <div>&nbsp;</div> <div><a href="http://msdn.microsoft.com/en-us/library/ms730158.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/ms730158.aspx</a></div> <div>&nbsp;</div> <div>The article above provides some great information on how to use the different hosting services and explains in detail the key benefits and limitations to each.</div> <div>&nbsp;</div> <div>For more specific information about each hosting service check out the following links also referenced in the above article:</div> <div>&nbsp;</div> <div>- <a href="http://msdn.microsoft.com/en-us/library/ms731758.aspx" target="_blank">Self-Hosting in a Managed Application</a><br /> - <a href="http://msdn.microsoft.com/en-us/library/ms733069.aspx" target="_blank">Managed Windows Services</a><br /> - <a href="http://msdn.microsoft.com/en-us/library/ms733766.aspx" target="_blank">Internet Information Services (IIS)</a><br /> - <a href="http://msdn.microsoft.com/en-us/library/ms733109.aspx" target="_blank">Windows Process Activation Service (WAS)</a></div> <div>&nbsp;</div> <div>These links were very helpful in understanding the different hosting options available for WCF services and more importantly understanding the right hosting environment to use based on&nbsp; <em>"... the version of Windows on which it is deployed, the transports it requires to send messages and the type of process and application domain recycling it requires."</em></div>Matt PaveyWCFhttp://www.pavey.net/?BlogID=4842009-01-12 20:54:49Creating your first WCF servicehttp://www.pavey.net/?BlogID=483<div>If you are just getting started with Windows Communication Foundation (WCF) here's a great resource with videos that really help get you moving in the right direction.</div> <div>&nbsp;</div> <div>The videos will make more sense if watched in the following order:</div> <div>&nbsp;</div> <div><a href="http://channel9.msdn.com/shows/Endpoint/Endpoint-Screencasts-Creating-Your-First-WCF-Service/" target="_blank">http://channel9.msdn.com/shows/Endpoint/Endpoint-Screencasts-Creating-Your-First-WCF-Service/</a><br /> &nbsp;<br /> <a href="http://channel9.msdn.com/shows/Endpoint/Endpoint-Screencasts-Configuring-Services-with-Endpoints/" target="_blank">http://channel9.msdn.com/shows/Endpoint/Endpoint-Screencasts-Configuring-Services-with-Endpoints/</a><br /> &nbsp;<br /> <a href="http://channel9.msdn.com/shows/Endpoint/Endpoint-Screencasts-Hosting-WCF-Services-in-IIS/" target="_blank">http://channel9.msdn.com/shows/Endpoint/Endpoint-Screencasts-Hosting-WCF-Services-in-IIS/</a><br /> &nbsp;<br /> <a href="http://channel9.msdn.com/shows/Endpoint/Endpoint-Screencasts-Self-hosting-WCF-Services/" target="_blank">http://channel9.msdn.com/shows/Endpoint/Endpoint-Screencasts-Self-hosting-WCF-Services/</a></div> <div>&nbsp;</div> <div>The videos demonstrate the following:</div> <div>&nbsp;</div> <div>- Creating a WCF service</div> <div>- Configuring a WCF service with various endpoints</div> <div>- How to host a WCF service in IIS</div> <div>- How to self-host&nbsp;a WCF service in your own applications</div> <div>&nbsp;</div> <div>For additional information on WCF, check out the&nbsp;<a href="http://msdn.microsoft.com/wcf/" target="_blank">WCF Dev Center on MSDN</a> and the <a href="http://blogs.msdn.com/endpoint/" target="_blank">.NET Endpoint team blog</a>.</div>Matt PaveyWCFhttp://www.pavey.net/?BlogID=4832009-01-12 20:34:11SQL Server 2008 Management Studiohttp://www.pavey.net/?BlogID=481<div>Here is the error I received:</div> <div><br /> TITLE: Microsoft SQL Server Management Studio<br /> ------------------------------<br /> <br /> Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc)<br /> <br /> For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&amp;LinkId=20476<br /> <br /> ------------------------------<br /> ADDITIONAL INFORMATION:<br /> <br /> An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)<br /> <br /> ------------------------------<br /> <br /> The server principal "UserName" is not able to access the database "DatabaseName" under the current security context. (Microsoft SQL Server, Error: 916)<br /> <br /> For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&amp;ProdVer=09.00.3239&amp;EvtSrc=MSSQLServer&amp;<br/>EvtID=916&amp;LinkId=20476<br /> <br /> ------------------------------<br /> BUTTONS:<br /> <br /> OK<br /> ------------------------------</div> <div>&nbsp;</div> <div>After doing some digging I found the answer on <a href="http://sqlblog.com/blogs/aaron_bertrand/default.aspx" target="_blank">Aaron Bertrand's</a> SQL blog.</div> <div>&nbsp;</div> <div><a href="http://sqlblog.com/blogs/aaron_bertrand/archive/2008/07/07/a-little-management-studio-oops.aspx" target="_blank">http://sqlblog.com/blogs/aaron_bertrand/archive/2008/07/07/a-little-management-studio-oops.aspx</a></div> <div>&nbsp;</div> <div><em>"For those of you who connect to database servers where you are not in full control over all databases, or where some of your databases are ever offline (or auto-closed), the new version of Management Studio that is shipping with SQL Server 2008 is going to bring you some surprises, when you try to present a list of databases in Object Explorer."</em></div> <div>&nbsp;</div> <div><em>"It seems that the ability to do so is hinged upon the columns that are set up in Object Explorer Details by default.&nbsp; In the case I came across yesterday, the offender was "Collation."&nbsp; The problem is that for a database that is offline or has been auto-closed, collation comes back as NULL.&nbsp; Well, that's not really the problem... the real problem is that SSMS throws its hands in the air when it comes across NULL for these values, and assumes this is NULL because you don't have permission."</em></div> <div><em></em>&nbsp;</div> <div><em>"And then refuses to show the data for ANY database, instead of just hiding the one(s) that caused the error.&nbsp; And this is true whether or not you have Object Explorer Details even open (my guess here is that the contents of OED are cached behind the scenes, even when it is disabled... which I speculate may be part of the reason behind the sluggishness that many have complained about).&nbsp; You can read more about this in </em><a title="Connect #354322" href="http://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=354322" target="_blank"><em>Connect #354322</em></a><em> and in </em><a title="Connect #354291" href="http://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=354291" target="_blank"><em>Connect #354291</em></a><em>."</em><br /> </div> <div><em></em>&nbsp;</div> <div><em>"For those of you that connect to databases that are hosted by 3rd party providers, some of which are accustomed to leaving as many databases in auto-close mode as possible, you are first going to have to go to Object Explorer Details, right-click the column header list, and un-check Collation.&nbsp; At this point, if you refresh the Databases node in Object Explorer, you should again see all of the databases on the server, even those where you don't have access.&nbsp; Strangely enough, OED still shows you some other data by default, that it probably shouldn't (e.g. recovery model, last backup, owner)."</em></div>Matt PaveySQL Serverhttp://www.pavey.net/?BlogID=4812008-12-28 22:16:04Check/Uncheck all items in a CheckBoxList using ASP.NET and JavaScripthttp://www.pavey.net/?BlogID=480<div>Here's an easy way to check or uncheck all items in a CheckBoxList.</div> <div>&nbsp;</div> <div><a href="http://www.dotnetcurry.com/ShowArticle.aspx?ID=77&amp;AspxAutoDetectCookieSupport=1" target="_blank">http://www.dotnetcurry.com/ShowArticle.aspx?ID=77&amp;AspxAutoDetectCookieSupport=1</a></div> <div>&nbsp;</div> <div><strong>JavaScript</strong></div> <div>&nbsp;</div> <div><font color="#0000ff" size="2"><font color="#0000ff" size="2"><font size="1">function</font></font></font><font size="1"> CheckBoxListSelect(cbControl, state)</font></div> <div><font size="1">{</font></div> <div><font size="1">&nbsp;&nbsp;&nbsp;&nbsp; <font color="#0000ff"><font color="#0000ff">var</font></font> chkBoxList = document.getElementById(cbControl);</font></div> <div><font size="1">&nbsp;&nbsp;&nbsp;&nbsp; <font color="#0000ff"><font color="#0000ff">var</font></font> chkBoxCount = chkBoxList.getElementsByTagName(<font color="#a31515"><font color="#a31515">"input"</font></font>);</font></div> <div>&nbsp;</div> <div><font size="1">&nbsp;&nbsp;&nbsp;&nbsp; <font color="#0000ff"><font color="#0000ff">for</font></font>(<font color="#0000ff"><font color="#0000ff">var</font></font> i=0; i &lt; chkBoxCount.length; i++)</font></div> <div><font size="1">&nbsp;&nbsp;&nbsp;&nbsp; {</font></div> <div><font size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; chkBoxCount[i].checked = state;</font></div> <div><font size="1">&nbsp;&nbsp;&nbsp;&nbsp; }</font></div> <div>&nbsp;</div> <div><font size="1">&nbsp;&nbsp;&nbsp;&nbsp; <font color="#0000ff"><font color="#0000ff">return</font></font> <font color="#0000ff"><font color="#0000ff">false</font></font>;</font></div> <div><font size="1">}</font><font size="2"></div> </font> <div>&nbsp;</div> <div><strong>ASP.Net CheckBoxList</strong></div> <div>&nbsp;</div> <div><font size="1"><font color="#0000ff"><font color="#0000ff">&lt;</font></font><font color="#a31515"><font color="#a31515">div</font></font><font color="#0000ff"><font color="#0000ff">&gt;</font></font></font></div> <div><font size="1"><font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; &lt;</font><font color="#a31515"><font color="#a31515">a</font></font> <font color="#ff0000"><font color="#ff0000">href</font></font><font color="#0000ff"><font color="#0000ff">="javascript:void(0)"</font></font> <font color="#ff0000"><font color="#ff0000">onclick</font></font><font color="#0000ff"><font color="#0000ff">="javascript: CheckBoxListSelect('</font></font>&lt;%=chkStates.ClientID %&gt;<font color="#0000ff"><font color="#0000ff">', true)"&gt;</font></font>Select All<font color="#0000ff"><font color="#0000ff">&lt;/</font></font><font color="#a31515"><font color="#a31515">a</font></font><font color="#0000ff"><font color="#0000ff">&gt;</font></font> | <font color="#0000ff"><font color="#0000ff">&lt;</font></font><font color="#a31515"><font color="#a31515">a</font></font> <font color="#ff0000"><font color="#ff0000">href</font></font><font color="#0000ff"><font color="#0000ff">="javascript:void(0)"</font></font> <font color="#ff0000"><font color="#ff0000">onclick</font></font><font color="#0000ff"><font color="#0000ff">="javascript: CheckBoxListSelect('</font></font>&lt;%=chkStates.ClientID %&gt;<font color="#0000ff"><font color="#0000ff">', false)"&gt;</font></font>Select None<font color="#0000ff"><font color="#0000ff">&lt;/</font></font><font color="#a31515"><font color="#a31515">a</font></font><font color="#0000ff"><font color="#0000ff">&gt;</font></font></font></div> <div><font size="1"><font color="#0000ff"><font color="#0000ff">&lt;/</font></font><font color="#a31515"><font color="#a31515">div</font></font><font color="#0000ff"><font color="#0000ff">&gt;</font></font></font></div> <div><font size="1"></font>&nbsp;</div> <div><font size="1"><font color="#0000ff"><font color="#0000ff">&lt;</font></font><font color="#a31515"><font color="#a31515">div</font></font><font color="#0000ff"><font color="#0000ff">&gt;</font></font></font></div> <div><font size="1"><font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; &lt;</font><font color="#a31515"><font color="#a31515">asp</font></font><font color="#0000ff"><font color="#0000ff">:</font></font><font color="#a31515"><font color="#a31515">CheckBoxList</font></font> <font color="#ff0000"><font color="#ff0000">ID</font></font><font color="#0000ff"><font color="#0000ff">="chkStates"</font></font> <font color="#ff0000"><font color="#ff0000">RepeatColumns</font></font><font color="#0000ff"><font color="#0000ff">="6"</font></font> <font color="#ff0000"><font color="#ff0000">Width</font></font><font color="#0000ff"><font color="#0000ff">="100%"</font></font> <font color="#ff0000"><font color="#ff0000">runat</font></font><font color="#0000ff"><font color="#0000ff">="server"</font></font> <font color="#0000ff"><font color="#0000ff">/&gt;</font></font></font></div> <div><font size="2"><font size="1"><font color="#0000ff"><font color="#0000ff">&lt;/</font></font><font color="#a31515"><font color="#a31515">div</font></font><font color="#0000ff"><font color="#0000ff">&gt;</font></font></font></font></div>Matt PaveyASP.Nethttp://www.pavey.net/?BlogID=4802008-11-18 19:32:06SSIS loading Excel validation errorhttp://www.pavey.net/?BlogID=479<div>I ran into a situation today where I needed to have an <strong>Excel Source</strong> for an Excel file that would <u>not</u>&nbsp;always exist at the path specified in the <em>ExcelFilePath</em> property. This would cause the SSIS package to fail when the Excel file did not exist since the <strong>Data Flow Task</strong> could not validate the Excel file.</div> <div>&nbsp;</div> <div><a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2170106&amp;SiteID=1" target="_blank">http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2170106&amp;SiteID=1</a></div> <div>&nbsp;</div> <div>The simple fix was to right click the <strong>Data Flow Task</strong> and go to <em>Properties</em> and set the <em>DelayValidation</em> property to <em>True</em>.</div>Matt PaveySSIShttp://www.pavey.net/?BlogID=4792008-11-11 20:24:50Importing Excel data with SQL Server Integration Services SSIS with unicode and non-unicode data issueshttp://www.pavey.net/?BlogID=478<div><em>"If you have used SSIS to import Excel data into SQL Server you may have run into the issue of having to convert data from Unicode to non-Unicode."</em></div> <div>&nbsp;</div> <div>This article discusses some different options for handling Unicode to non-Unicode warning messages that are fairly common if you deal with importing data from one source to another, for example from Excel to SQL.</div> <div>&nbsp;</div> <div><a href="http://www.mssqltips.com/tip.asp?tip=1393" target="_blank">http://www.mssqltips.com/tip.asp?tip=1393</a></div> <div>&nbsp;</div> <div>In my case today I ended up just having to add a <strong>Data Conversion</strong> transformation between my <strong>Excel Source</strong> and <strong>SQL Server Destination</strong> to convert my data-types accordingly.</div>Matt PaveySSIShttp://www.pavey.net/?BlogID=4782008-11-11 20:24:29SQL Server 2008 Designer Behavior Change: Saving Changes Not Permittedhttp://www.pavey.net/?BlogID=476<div><em>Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created. You have either made changes to a table that can't be re-created or enabled the option Prevent saving changes that require the table to be re-created.</em></div> <div>&nbsp;</div> <div><a href="http://pragmaticworks.com/community/blogs/brianknight/archive/2008/06/04/sql-server-2008-designer-behavior-change-saving-changes-not-permitted.aspx" target="_blank">http://pragmaticworks.com/community/blogs/brianknight/archive/2008/06/04/sql-server-2008-designer-behavior-change-saving-changes-not-permitted.aspx</a></div> <div>&nbsp;</div> <div><em>"This is by design and can be quickly fixed in Management Studio by unchecking a property. To fix this in Management Studio, go to Tools -&gt; Options then go to the Designer Page and uncheck <strong>Prevent saving changes that require table re-creation</strong>."</em></div>Matt PaveySQL Serverhttp://www.pavey.net/?BlogID=4762008-10-30 12:49:47New Date Data Types in Microsoft SQL Server 2008http://www.pavey.net/?BlogID=475<div>Here's another good article article written by <a href="http://www.4guysfromrolla.com/ScottMitchell.shtml" target="_blank">Scott Mitchell</a>&nbsp;discussing the new date data types available in Microsoft SQL Server 2008.</div> <div>&nbsp;</div> <div><em>"This article explores the <code>time</code> and <code>date</code> data types and shows how they can be used and formatted from within an ASP.NET page. This article also includes a short discussion on the <code>datetime2</code> and <code>datetimeoffset</code> and compares and constrasts SQL Server 2008's six different date data types."</em></div> <div>&nbsp;</div> <div><a href="http://aspnet.4guysfromrolla.com/articles/101508-1.aspx" target="_blank">http://aspnet.4guysfromrolla.com/articles/101508-1.aspx</a></div> <div>&nbsp;</div> <div><a href="http://www.4guysfromrolla.com/ScottMitchell.shtml" target="_blank">Scott Mitchell</a>&nbsp;is the the editor, founder, and primary contributor to <a href="http://www.4guysfromrolla.com/" target="_blank">4GuysFromRolla.com</a>.</div>Matt PaveySQL Serverhttp://www.pavey.net/?BlogID=4752008-10-21 18:47:35Web Platform Installer: Trying to make it easier to setup for web developmenthttp://www.pavey.net/?BlogID=474<a href="http://www.hanselman.com/blog/WebPlatformInstallerTryingToMakeItEasierToSetupForWebDevelopment.aspx" target="_blank">http://www.hanselman.com/blog/WebPlatformInstallerTryingToMakeItEasierToSetupForWebDevelopment.aspx</a>Matt PaveyOtherhttp://www.pavey.net/?BlogID=4742008-10-21 18:40:11Lightbox2http://www.pavey.net/?BlogID=472"Lightbox is a <em>simple, unobtrusive</em> script used to overlay images on the current page. It's a <em>snap to setup</em> and works on <em>all modern browsers</em>." <p><a href="http://www.huddletogether.com/projects/lightbox2" target="_blank">http://www.huddletogether.com/projects/lightbox2</a></p>Matt PaveyOtherhttp://www.pavey.net/?BlogID=4722008-10-03 15:27:47Adobe Spry framework for AJAXhttp://www.pavey.net/?BlogID=471<em>Spry is a JavaScript-based framework that enables the rapid development of Ajax-powered web pages. Not a JavaScript guru? No problem. Spry was designed to feel like an extension of HTML and CSS, so anyone with basic web-production skills can create next-generation web experiences by adding the power of Ajax to their pages.</em> <p><em>Spry can be used with any server-side technology (ColdFusion, PHP, ASP.Net etc.). By building the front-end of your web application with Spry you enable a more efficient designer-developer workflow by keeping UI separated from back-end application logic.</em></p> <p><strong>Home:<br /> </strong><a href="http://labs.adobe.com/technologies/spry/home.html" target="_blank">http://labs.adobe.com/technologies/spry/home.html</a></p> <p><strong>Demos:</strong><br /> <a href="http://labs.adobe.com/technologies/spry/samples/" target="_blank">http://labs.adobe.com/technologies/spry/samples/</a></p>Matt PaveyOtherhttp://www.pavey.net/?BlogID=4712008-09-24 12:31:07The Yahoo! User Interface Library (YUI)http://www.pavey.net/?BlogID=470<div><em>The Yahoo! User Interface (YUI) Library is a set of utilities and controls, written in JavaScript, for building richly interactive web applications using techniques such as DOM scripting, DHTML and AJAX. The YUI Library also includes several core CSS resources. All components in the YUI Library have been released as open source under a </em><a href="http://developer.yahoo.com/yui/license.html" target="_blank"><em>BSD license</em></a><em> and are free for all uses.</em></div> <div>&nbsp;</div> <div><a href="http://developer.yahoo.com/yui/" target="_blank">http://developer.yahoo.com/yui/</a></div>Matt PaveyOtherhttp://www.pavey.net/?BlogID=4702008-09-24 12:22:22Granting execute permissions to all stored procedures in a databasehttp://www.pavey.net/?BlogID=469<em>"Whilst SQL Server 2000 has fixed database roles such as db_datareader and db_datawriter that allow a user read or write access respectively to all the table is a database, no such role exists for the execution of stored procedures (a db_executor role if you will). This article describes how to grant execute permission to all stored procedures in a database to a specific user or role in both SQL2000 and SQL2005."</em> <br><br> <a href="http://www.sqldbatips.com/showarticle.asp?ID=8" target="_blank">http://www.sqldbatips.com/showarticle.asp?ID=8</a>Matt PaveySQL Serverhttp://www.pavey.net/?BlogID=4692008-09-11 01:03:55Sending Email in ASP.NET 2.0http://www.pavey.net/?BlogID=468<div>Coincidentally for the 3rd time in the past week an issue I was working on led me to an article written by <a href="http://www.4guysfromrolla.com/ScottMitchell.shtml" target="_blank"><font color="#0000cc">Scott Mitchell</font></a>. </div> <div>&nbsp;</div> <div><a href="http://aspnet.4guysfromrolla.com/articles/072606-1.aspx" target="_blank">http://aspnet.4guysfromrolla.com/articles/072606-1.aspx</a></div> <div>&nbsp;</div> <div><em>"The relay server information used by the <strong>SmtpClient</strong> class can be specified programmatically, through the <strong>SmtpClient</strong> class's properties, or can be centralized in <strong>Web.config</strong>. To use the <strong>Web.config</strong> approach, add a <strong>&lt;system.net&gt;</strong> element within the <strong>&lt;configuration&gt;</strong> element. Then, add a <strong>&lt;mailSettings&gt;</strong> element that contains an <strong>&lt;smtp&gt;</strong> element whose settings are specified within its <strong>&lt;network&gt;</strong> child element, like so:"</em></div> <div><font color="#0000ff" size="2"><font color="#0000ff" size="2"></font></font>&nbsp;</div> <div><font size="1"><font color="#0000ff"><font color="#0000ff">&lt;</font></font><font color="#a31515"><font color="#a31515">configuration</font></font></font><font size="1"><font color="#0000ff"><font color="#0000ff">&gt;<br /> &nbsp;&nbsp;&nbsp;&nbsp; &lt;!--</font></font><font color="#008000"><font color="#008000"> Add the email settings to the &lt;system.net&gt; element </font></font></font><font size="1"><font color="#0000ff"><font color="#0000ff">--&gt;<br /> &nbsp;&nbsp;&nbsp;&nbsp; &lt;</font></font><font color="#a31515"><font color="#a31515">system.net</font></font></font><font size="1"><font color="#0000ff"><font color="#0000ff">&gt;<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;</font></font><font color="#a31515"><font color="#a31515">mailSettings</font></font></font><font size="1"><font color="#0000ff"><font color="#0000ff">&gt;<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;</font></font><font color="#a31515"><font color="#a31515">smtp</font></font></font><font size="1"><font color="#0000ff"><font color="#0000ff">&gt;<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></font><font color="#0000ff"><font color="#0000ff">&lt;</font></font></font><font size="1"><font color="#a31515"><font color="#a31515">network <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></font><font color="#ff0000"><font color="#ff0000">host</font></font><font color="#0000ff"><font color="#0000ff">=</font></font>"<font color="#0000ff"><font color="#0000ff">relayServerHostname</font></font>"<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff0000"><font color="#ff0000">port</font></font><font color="#0000ff"><font color="#0000ff">=</font></font>"<font color="#0000ff"><font color="#0000ff">portNumber</font></font>"<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#ff0000"><font color="#ff0000">userName</font></font><font color="#0000ff"><font color="#0000ff">=</font></font>"<font color="#0000ff"><font color="#0000ff">username</font></font>"<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#ff0000"><font color="#ff0000">password</font></font><font color="#0000ff"><font color="#0000ff">=</font></font>"<font color="#0000ff"><font color="#0000ff">password</font></font>"</font><font size="1"><font color="#0000ff"><font color="#0000ff"> /&gt;<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/</font></font><font color="#a31515"><font color="#a31515">smtp</font></font></font><font size="1"><font color="#0000ff"><font color="#0000ff">&gt;<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/</font></font><font color="#a31515"><font color="#a31515">mailSettings</font></font></font><font size="1"><font color="#0000ff"><font color="#0000ff">&gt;<br /> &nbsp;&nbsp;&nbsp;&nbsp; &lt;/</font></font><font color="#a31515"><font color="#a31515">system.net</font></font></font><font size="1"><font color="#0000ff"><font color="#0000ff">&gt;<br /> <br /> &nbsp;&nbsp;&nbsp;&nbsp; &lt;</font></font><font color="#a31515"><font color="#a31515">system.web</font></font></font><font size="1"><font color="#0000ff"><font color="#0000ff">&gt;<br /> </font></font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br /> <font color="#0000ff"><font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; &lt;/</font></font><font color="#a31515"><font color="#a31515">system.web</font></font></font><font size="1"><font color="#0000ff"><font color="#0000ff">&gt;<br /> &lt;/</font></font><font color="#a31515"><font color="#a31515">configuration</font></font><font color="#0000ff" size="2"><font color="#0000ff" size="2">&gt;</div> </font></font></font> <div>&nbsp;</div> <div><a href="http://www.4guysfromrolla.com/ScottMitchell.shtml" target="_blank">Scott Mitchell</a>&nbsp;is the the editor, founder, and primary contributor to <a href="http://www.4guysfromrolla.com/" target="_blank">4GuysFromRolla.com</a>.</div>Matt Pavey.Nethttp://www.pavey.net/?BlogID=4682008-08-18 10:51:50Taking an ASP.NET 2.0 Application Offlinehttp://www.pavey.net/?BlogID=467Here's another good article written by <a href="http://www.4guysfromrolla.com/ScottMitchell.shtml" target="_blank">Scott Mitchell</a>. <div>&nbsp;</div> <div><a href="http://aspnet.4guysfromrolla.com/articles/110707-1.aspx" target="_blank">http://aspnet.4guysfromrolla.com/articles/110707-1.aspx</a></div> <div>&nbsp;</div> <div><em>"When updating a web application that's currently in production, it is best to take the application offline so that users understand that the application is being worked on. This can be accomplished in a variety of ways, from simply stopping the web server software to displaying a web page that informs the user that the site is offline for maintenance. What you don't want to do is have the application appear to work, only to have some error pop up later because you are in the middle of updating the production server. This is a sure-fired way to frustrate your users."</em></div> <div>&nbsp;</div> <div>The article discusses 4 ways to take an application offline:</div> <ul> <li>Taking a Website Offline through IIS <li>Disabling the &lt;httpRuntime&gt; <li>Using App_Offline.htm <li>Creating a "Manage Offline Status" Page</li> </ul> <div><a href="http://www.4guysfromrolla.com/ScottMitchell.shtml" target="_blank">Scott Mitchell</a>&nbsp;is the the editor, founder, and primary contributor to <a href="http://www.4guysfromrolla.com/" target="_blank">4GuysFromRolla.com</a>.</div>Matt Pavey.Nethttp://www.pavey.net/?BlogID=4672008-08-17 18:20:23Displaying the Sizes of Your SQL Server's Database's Tableshttp://www.pavey.net/?BlogID=466<div>By <a href="http://www.4guysfromrolla.com/ScottMitchell.shtml" target="_blank">Scott Mitchell</a><br /> <br /> <a href="http://www.4guysfromrolla.com/webtech/032906-1.shtml" target="_blank">http://www.4guysfromrolla.com/webtech/032906-1.shtml</a></div> <div>&nbsp;</div> <div><em>"SQL Server has a handy little system stored procedure named <strong>sp_spaceused</strong> that will return the space used by a database or by a particular table. To determine the size used by the <strong>database</strong>, simply run:"</em></div> <div><em></em>&nbsp;</div> <div><font face="Courier New">EXEC sp_spaceused</font> </div> <div><em></em>&nbsp;</div> <div><em>"This will return two result sets, the first one containing the database name, size, and unallocated space and the second containing a breakdown of the database's size into how much size is reserved and how much of that is taken up by data, how much by indexes, and how much remains unused."</em></div> <div><em></em>&nbsp;</div> <div><em>"To return information about a particular <strong>table</strong>, simply call <strong>sp_spaceused</strong> passing in as the first parameter the name of the table. To determine the space used by the Orders table in the Northwind database use:"</em></div> <div>&nbsp;</div> <div><font face="Courier New">EXEC sp_spaceused 'Orders'</font></div> <div>&nbsp;</div> <div>This will return a single result set that provides the following information:</div> <ul> <li><strong>Name</strong> - the name of the table <li><strong>Rows</strong> - the number of rows in the table <li><strong>Reserved</strong> - amount of total reserved space for the table <li><strong>Data</strong> - amount of space used by the data for the table <li><strong>Index_Size</strong> - amount of space used by the table's indexes <li><strong>Unused</strong> - amount of usused space in the table </li> </ul> <p><em>"While <strong>sp_spaceused</strong> can be used to return the space usage for a single table, more than likely we want a web page where we can view the space used for all tables in a database. There are a number of ways to accomplish this, but in short we need to execute <strong>sp_spaceused</strong> once for every table in the database. In order to accomplish that we could do one of two things:"</em> </p> <ul> <li>Query the <strong>sysobjects</strong> table to get a list of tables in the database, then use a <strong>CURSOR</strong> to iterate through these table results one at a time, executing <strong>sp_spaceused</strong> for each one.<br /> <li>Use the undocumented <strong>sp_MSforeachtable</strong> stored procedure, which takes in a command and executes that command against all of the user tables in the database. </li> </ul> <p><em>"The <strong>sp_MSforeachtable</strong> stored procedure is one of many undocumented stored procedures tucked away in the depths of SQL Server. A list of these handy stored procedures can be found at <a href="http://www.mssqlcity.com/Articles/Undoc/SQL2000UndocSP.htm" target="_blank">SQL Server 2000 Useful Undocumented Stored Procedures</a>. In short, you can use <strong>sp_MSforeachtable</strong> like so:"</em></p> <p><font face="Courier New">EXEC sp_MSforeachtable @command1="<em><strong>command to run</strong></em>"</font></p> <p><em>"In the <strong>command to run</strong> put a ? where you want the table name to be inserted. For example, to run the <strong>sp_spaceused</strong> stored procedure for each table in the database, we'd use:"</em></p> <p><font face="Courier New">EXEC sp_MSforeachtable @command1="EXEC sp_spaceused '?'"</font></p> <div>This will execute <strong>EXEC sp_spaceused 'TableName'</strong> for each user table in the database.</div> <div>&nbsp;</div> <div><em>"An alternative option is to create a stored procedure from which a temporary table is created and populated with one record for each result set returned by sp_spaceused. The entire results, then, can be returned to the ASP.NET page as a single result set by selecting the entire contents of the temporary table at the end of the stored procedure."</em></div> <p><font color="#0000ff" size="2"><font color="#0000ff" size="2"><font size="1">create</font></font></font><font size="1"> <font color="#0000ff"><font color="#0000ff">table</font></font> #spaceused </font><font color="#808080"><font color="#808080"><font size="1">(</font></font></font><font size="1"><font color="#0000ff"><font color="#0000ff">name</font></font> <font color="#0000ff"><font color="#0000ff">varchar</font></font><font color="#808080"><font color="#808080">(</font></font>128<font color="#808080"><font color="#808080">),</font></font> <font color="#0000ff"><font color="#0000ff">rows</font></font> <font color="#0000ff"><font color="#0000ff">bigint</font></font><font color="#808080"><font color="#808080">,</font></font> reserved <font color="#0000ff"><font color="#0000ff">varchar</font></font><font color="#808080"><font color="#808080">(</font></font>25<font color="#808080"><font color="#808080">),</font></font> data <font color="#0000ff"><font color="#0000ff">varchar</font></font><font color="#808080"><font color="#808080">(</font></font>25<font color="#808080"><font color="#808080">),</font></font> index_size <font color="#0000ff"><font color="#0000ff">varchar</font></font><font color="#808080"><font color="#808080">(</font></font>25<font color="#808080"><font color="#808080">),</font></font> unused <font color="#0000ff"><font color="#0000ff">varchar</font></font><font color="#808080"><font color="#808080">(</font></font>25<font color="#808080"><font color="#808080">))</font></font> </font></p> <font color="#0000ff"><font color="#0000ff"> <p><font size="1">EXEC</font></font></font><font size="1"> <font color="#800000"><font color="#800000">sp_MSforeachtable</font></font> @command1<font color="#808080"><font color="#808080">=</font></font>"insert into #spaceused EXEC sp_spaceused '?'" </font></p> <font color="#0000ff"><font color="#0000ff"> <p><font size="1">select</font></font></font><font size="1"> <font color="#808080"><font color="#808080">*</font></font> <font color="#0000ff"><font color="#0000ff">from</font></font> #spaceused </font></p> <font color="#0000ff"><font color="#0000ff"> <p><font size="1">drop</font></font></font><font size="1"> <font color="#0000ff"><font color="#0000ff">table</font></font> #spaceused </font></p> <div>The above SQL code courtesy of Toby.</div> <div>&nbsp;</div> <div><a href="http://www.4guysfromrolla.com/ScottMitchell.shtml" target="_blank">Scott Mitchell</a>&nbsp;is the the editor, founder, and primary contributor to <a href="http://www.4guysfromrolla.com/" target="_blank">4GuysFromRolla.com</a>.</div>Matt PaveySQL Serverhttp://www.pavey.net/?BlogID=4662008-08-12 23:30:07Scheduling Backups for SQL Server 2005 Expresshttp://www.pavey.net/?BlogID=465<div><em>"One problem with SQL Server 2005 Express is that it does not offer a way to schedule jobs. In a previous tip, <font style="color: #000000" color="#000000"><a href="http://www.mssqltips.com/tip.asp?tip=1083" target="_blank">Free Job Scheduling Tool for SQL Server Express and MSDE</a>,</font> we looked at a free tool that allows you to create scheduled jobs for SQL Server. The one issue people often face though is what to install and what not to install on their production servers and therefore these items go without resolution. One very important part of managing SQL Server is to ensure you run backups on a set schedule. I often hear about corrupt databases and no backups, so let's take a look at another approach of scheduling backups using the included tools in both the operating system and SQL Server."</em></div> <div>&nbsp;</div> <div>This article provides an easy solution for using the SQL&nbsp;<strong>BACKUP</strong> command to backup a database and shows you how to use <strong>SQLCMD.EXE</strong> with <strong>Scheduled Tasks</strong> to schedule it to run automatically, thus giving you the scheduled backups&nbsp;functionality you would typically have in SQL Server Agent.</div> <div>&nbsp;</div> <div><a href="http://www.mssqltips.com/tip.asp?tip=1174" target="_blank">http://www.mssqltips.com/tip.asp?tip=1174</a></div>Matt PaveySQL Serverhttp://www.pavey.net/?BlogID=4652008-07-31 18:50:26Web Farms and ASP.NET ViewStatehttp://www.pavey.net/?BlogID=464<div><em>"The default ASP.NET settings ensure that forms authentication tickets are tamper proof and encrypted, and that ViewState is tamper proof. This ensures that any modification of the ViewState or authentication tickets either on the client's computer or over the network is detected when the server processes the data."</em></div> <div>&nbsp;</div> <div>For example, when the viewstate generated on server&nbsp;A is&nbsp;posted back to server B you may receive a viewstate validation error if the &lt;machineKey&gt; is not the same on all of the servers in the web farm or cluster.</div> <div>&nbsp;</div> <div>Here is one of the exceptions you may receive:</div> <div>&nbsp;</div> <div><em>Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that &lt;machineKey&gt; configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.</em></div> <div>&nbsp;</div> <div>This is because the viewstate is salted with a unique, autogenerated machine key from the originating server's machine.config file.</div> <div>&nbsp;</div> <div><em>"This is done to prevent users from somehow tampering with the ViewState. Any change to the ViewState data on the client will be detected. But this has a side effect: it also prevents multiple servers from processing the same ViewState. One solution is to force every server in your farm to use the same key -- generate a hex encoded 64-bit or 128-bit &lt;machineKey&gt; and put that in each server's machine.config"</em></div> <div>&nbsp;</div> <div>If you do not have access to the machine.config files in the web farm or cluster you can disable the enableViewStateMac using a simple page directive:</div> <div>&nbsp;</div> <div>&lt;%@ Page Language="vb" AutoEventWireup="false" Codebehind="MyPage.aspx.vb"<br /> &nbsp;Inherits="MyAssembly.MyPage" <strong>enableViewStateMac="false"</strong> %&gt;</div> <div>&nbsp;</div> <div>Alternately, you can modify the pages element in Web.config:</div> <div>&nbsp;</div> <div>&lt;system.web&gt;<br /> &nbsp; &lt;pages <strong>enableViewStateMac="false"</strong> /&gt;<br /> &lt;/system.web&gt;</div> <div><br /> Of course caution should be taken when setting the enableViewStateMac to <strong>false&nbsp;</strong>since the viewstate could potentially be tampered with.</div> <div>&nbsp;</div> <div><strong>If you have a web farm or cluster and receive this error the optimal solution would be to update the machine.config files on all of the servers in the web farm or cluster to ensure that the &lt;machineKey&gt; configuration specifies the same validationKey and validation algorithm.</strong></div> <div>&nbsp;</div> <div><a href="http://www.codinghorror.com/blog/archives/000132.html" target="_blank">http://www.codinghorror.com/blog/archives/000132.html</a></div> <div>&nbsp;</div> <div><a href="http://blogs.msdn.com/rich_crane/archive/2004/05/12/130693.aspx" target="_blank">http://blogs.msdn.com/rich_crane/archive/2004/05/12/130693.aspx</a></div> <div>&nbsp;</div> <div><a href="http://msdn.microsoft.com/en-us/library/ms998288.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/ms998288.aspx</a></div>Matt Pavey.Nethttp://www.pavey.net/?BlogID=4642008-07-31 18:49:49Checking All CheckBoxes in a GridView Using Client-Side Script and a Check All CheckBoxhttp://www.pavey.net/?BlogID=463<em>"In this article we saw how to add a "Check/Uncheck All" header CheckBox to the GridView that, using client-side techniques, provides a means to quickly check or uncheck all row-level CheckBoxes. The header CheckBox, along with the "Check All" and "Uncheck All" buttons, provide the user with multiple ways for checking or unchecking all of the grid's CheckBoxes. Since client-side script is used to handle checking and unchecking the CheckBoxes, the interface provides a snappy user experience."</em> <p><a href="http://aspnet.4guysfromrolla.com/articles/053106-1.aspx" target="_blank">http://aspnet.4guysfromrolla.com/articles/053106-1.aspx</a></p>Matt PaveyASP.Nethttp://www.pavey.net/?BlogID=4632008-05-22 09:47:09LINQ Dynamic Querieshttp://www.pavey.net/?BlogID=462<div>I came across an article this morning that helped me with a LINQ query issue that I was trying to work through regarding dynamic queries.</div> <div>&nbsp;</div> <div><a href="http://www.rocksthoughts.com/blog/archive/2008/01/24/linq-to-sql-dynamic-queries.aspx" target="_blank">http://www.rocksthoughts.com/blog/archive/2008/01/24/linq-to-sql-dynamic-queries.aspx</a></div> <div>&nbsp;</div> <div>My situation was very similar; however, in my case I was querying an ENTITY rather than SQL directly; however, the same rules applied.</div> <div>&nbsp;</div> <div>I knew I could easily write a query that was <u>not</u> type safe and <u>not</u> checked at compile time; however, the thought of doing that really bothered me because I wanted to leverage the full power of LINQ and keep everything type safe and checked at compile time.</div> <div>&nbsp;</div> <div>I ended up taking advantage of Lambda Expressions:</div> <font size="1"><font color="#0000ff"> <div><br /> Public</font> <font color="#0000ff">Function</font> Search(<font color="#0000ff">ByVal</font>&nbsp;Name <font color="#0000ff">As</font> <font color="#0000ff">String</font>, <font color="#0000ff">ByVal</font>&nbsp;City <font color="#0000ff">As</font> <font color="#0000ff">String</font>) <font color="#0000ff">As</font> IEnumerable(<font color="#0000ff">Of</font> MyTable)<br /> &nbsp;&nbsp;&nbsp;&nbsp; </font><font size="1"><font color="#0000ff">Dim</font> MyEntities <font color="#0000ff">As</font> <font color="#0000ff">New</font> DbEntities()<br /> &nbsp;&nbsp;&nbsp;&nbsp; </font><font size="1"><font color="#0000ff">Dim</font> MyQuery <font color="#0000ff">As</font> ObjectQuery(<font color="#0000ff">Of</font> MyTable) = MyEntities.MyTableSet<br /> &nbsp;&nbsp;&nbsp;&nbsp; </font><font size="1"><font color="#0000ff">Dim</font> MyResults = <font color="#0000ff">From</font> x <font color="#0000ff">In</font> MyQuery <font color="#0000ff">Select</font> x<br /> <br /> &nbsp;&nbsp;&nbsp;&nbsp; </font><font size="1"><font color="#0000ff">If</font> <font color="#0000ff">Not</font> IsBlank(Name) <font color="#0000ff">Then<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></font><font size="1">MyResults = MyResults.Where(<font color="#0000ff">Function</font>(e) e.Name.Equals(Name))<br /> &nbsp;&nbsp;&nbsp;&nbsp; </font><font size="1"><font color="#0000ff">End</font> <font color="#0000ff">If</font></font></div> <div>&nbsp;</div> <div><font size="1"><font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; If</font> <font color="#0000ff">Not</font> IsBlank(City) </font><font color="#0000ff"><font size="1">Then<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></font><font size="1">MyResults = MyResults.Where(<font color="#0000ff">Function</font>(e) e.City.Equals(City))<br /> &nbsp;&nbsp;&nbsp;&nbsp; </font><font size="1"><font color="#0000ff">End</font> <font color="#0000ff">If<br /> <br /> &nbsp;&nbsp;&nbsp;&nbsp; </font></font><font size="1"><font color="#0000ff">Return</font> MyResults.AsEnumerable<br /> </font><font size="1"><font color="#0000ff">End Function</font><font color="#0000ff" size="2"></div> </font></font> <div>&nbsp;</div> <div>More information on Lambda Expressions can be found here:</div> <div>&nbsp;</div> <div><a href="http://weblogs.asp.net/scottgu/archive/2007/04/08/new-orcas-language-feature-lambda-expressions.aspx" target="_blank">http://weblogs.asp.net/scottgu/archive/2007/04/08/new-orcas-language-feature-lambda-expressions.aspx</a></div>Matt PaveyLINQhttp://www.pavey.net/?BlogID=4622008-05-06 10:46:50ADO.NET Entity Framework Beta 3http://www.pavey.net/?BlogID=461<div>I started working on a new application for a client this week that is going to use the ADO.NET Entity Framework. Since it is not final release yet I had to download and setup the ADO.NET Entity Framework Beta 3. It wasn't too bad to get installed but I did run into a few issues along the way that I thought I'd share to save you some time if you end up having to do something similar.</div> <div>&nbsp;</div> <div>I ended up having to install the following in this order:</div> <div>&nbsp;</div> <div><strong>ADO.NET Entity Framework Beta 3</strong></div> <div><a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=15DB9989-1621-444D-9B18-D1A04A21B519&amp;displaylang=en" target="_blank">http://www.microsoft.com/downloads/details.aspx?FamilyId=15DB9989-1621-444D-9B18-D1A04A21B519&amp;displaylang=en</a></div> <div>&nbsp;</div> <div><strong>ADO.NET Entity Framework Tools Preview can only be installed if a necessary Visual Studio patch is installed.</strong></div> <div><a href="http://go.microsoft.com/fwlink/?LinkID=104985">http://go.microsoft.com/fwlink/?LinkID=104985</a></div> <div>&nbsp;</div> <div><strong>ADO.Net Entity Framework Tools Dec 07 Community Technology Preview</strong></div> <div><a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=D8AE4404-8E05-41FC-94C8-C73D9E238F82&amp;displaylang=en" target="_blank">http://www.microsoft.com/downloads/details.aspx?FamilyId=D8AE4404-8E05-41FC-94C8-C73D9E238F82&amp;displaylang=en</a></div> <div>&nbsp;</div> <div>At this point I had everything installed so I could add a <em>ADO.NET Entity Data Model</em> to my project.</div> <div>&nbsp;</div> <div>Another good resource for ADO.NET related info can be found here:</div> <div>&nbsp;</div> <div><a href="http://blogs.msdn.com/adonet/" target="_blank">http://blogs.msdn.com/adonet/</a></div> <div>&nbsp;</div> <div>One other thing I did notice when working with the <em>ADO.NET Entity Data Model</em> was that it all seemed to be very straight forward to setup and test if your UI and data access were in the same project; however, I found that when setting up a n-tier architecture I ran into some annoyances. The data layer I setup contained my <em>ADO.NET Entity Data Model</em> and it automatically creates an <strong>App.Config</strong> file with the necessary connection information and it creates the <strong>.csdl </strong>file, <strong>.ssdl</strong> file and <strong>.msl</strong> file in the data layer's /bin folder; however, when you add a reference to your data layer from your UI or business layer it does <u>not</u> automatically copy the connection string information into your <strong>Web.config</strong> file and it does <u>not</u> copy the <strong>.csdl </strong>file, <strong>.ssdl</strong> file and <strong>.msl</strong> file into the web application's /bin folder. So I ran into error messages until I finally figured out was going on. </div> <div>&nbsp;</div> <div>To work arond this I created a <strong>Config/ConnectionStrings.config</strong> file and copied the connection information from the <strong>App.Config</strong> file into the new config file and had the <strong>Web.config</strong> reference the new config file. Then I copied the <strong>.csdl </strong>file, <strong>.ssdl</strong> file and <strong>.msl</strong> file into the web application's /bin folder. Once I did this I was able to use the <em>ADO.NET Entity Data Model</em> as my data access and isolate the data access to the data layer. The issue with this is that if you change your model you have to manually copy the files to the web application's /bin folder again. I'm hoping that I'm either just not doing something right or this is just because it is still Beta and will be easier in the final release.</div> <div>&nbsp;</div> <div>I also found that quite a few code samples&nbsp;I came across had the <em>Using ... End Using</em> notation around their entity code; however anytime I returned a generic list, for example IEnumerable(Of T), from the data layer to another layer the connection would be lost and I would get an error that said:</div> <div>&nbsp;</div> <div><em>A connection string must be set on the connection before attempting the operation.</em></div> <div>&nbsp;</div> <div>It wasn't apparent to me what the problem was initially but then I took out the <em>Using ... End Using</em> notation and everything worked perfect. The <em>End Using</em> code from the code samples was forcing certain objects to be destroyed, including the connection.</div> <div>&nbsp;</div> <div>I've tested retrieving data, adding data, deleting data, updating data, filtering data using standard LINQ syntax as well as Lambda Expressions and binding IEnumerable(Of T) data to a GridView.</div> <div>&nbsp;</div> <div>So aside from the minor annoyances I ran into along the way I now have a working project that uses the <em>ADO.NET Entity Data Model</em>.</div>Matt PaveyLINQhttp://www.pavey.net/?BlogID=4612008-05-06 10:29:01Temporary Tables and Dynamic SQLhttp://www.pavey.net/?BlogID=460<div>When programming in SQL sometimes you need to generate temporary tables inside a stored procedure. That's pretty straight forward with code like this:</div> <div><font color="#0000ff" size="2"><font size="1"></font></font>&nbsp;</div> <div><font color="#0000ff" size="2"><font size="1">SELECT&nbsp;&nbsp;&nbsp;&nbsp; </font></font><font size="1">TrackingGroupID<font color="#808080">,<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></font><font size="1">Tag</font></div> <div><font size="1"><font color="#0000ff">INTO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font>#temp<br /> </font><font size="1"><font color="#0000ff">FROM</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MyTable</font><font size="2"></div> </font> <div>&nbsp;</div> <div>And you can access #temp in the rest of your stored procedure and drop the temp table when complete.</div> <div>&nbsp;</div> <div><font color="#0000ff" size="2"><font size="1"><font color="#008000" size="1">-- testing<br /> </font><font color="#0000ff">SELECT</font><font color="#000000"> </font><font color="#ff00ff">COUNT</font><font color="#808080">(*)</font><font color="#000000"> </font><font color="#0000ff">FROM</font><font color="#000000"> #temp</font></font></font></div> <div><font color="#0000ff" size="2"><font size="1"></font></font>&nbsp;</div> <div><font color="#0000ff" size="2"><font size="1"><font color="#008000">-- drop temp table</font></font></font></div> <div><font color="#0000ff" size="2"><font size="1"><font color="#0000ff">DROP</font><font color="#000000"> </font><font color="#0000ff">TABLE</font><font size="2"><font color="#000000" size="1"> #temp</font></font></font></font></div> <div><font color="#0000ff" size="2"><font size="1"><font size="2"><font color="#000000" size="1"></font></font></font></font>&nbsp;</div> <div>But if you ever have a situation where you also need to&nbsp;use dynamic SQL you&nbsp;will likely have scope issues. In my particular case I ran into a situation where I needed to apply a dynamic filter to a query and store that data in a temporary table so I could access it after the filter was applied and do further manipulation and analysis and grouping with the data.</div> <div>&nbsp;</div> <div>Note: Typically when I work with temp tables I try to use tables-variables like so:</div> <div>&nbsp;</div> <div><font color="#008000" size="1">-- create temp table<br /> </font><font color="#0000ff"><font size="1">DECLARE</font></font><font size="1"> @Temp <font color="#0000ff">TABLE<br /> </font></font><font color="#808080" size="1">(<br /> &nbsp;&nbsp;&nbsp;&nbsp; </font><font size="1">TrackingGroupID&nbsp; <font color="#0000ff">INT</font><font color="#808080">,<br /> &nbsp;&nbsp;&nbsp;&nbsp; </font></font><font size="1">Tag&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#0000ff">VARCHAR</font><font color="#808080">(</font>50<font color="#808080">)</font> <font color="#808080">NOT</font> <font color="#808080">NULL</font> <font color="#0000ff">DEFAULT</font> <font color="#ff0000">''<br /> </font></font><font color="#808080" size="1">)</div> </font> <div>&nbsp;</div> <div>However, in this case I was not able to get a table-variable to work. So I ended up using a #temp table instead.</div> <div>&nbsp;</div> <div>My first attempt looked something like this:</div> <div><font color="#008000" size="1"></font>&nbsp;</div> <div><font color="#008000" size="1">-- declare variables<br /> </font><font color="#0000ff"><font size="1">DECLARE</font></font><font size="1"> @SQL <font color="#0000ff">VARCHAR</font><font color="#808080">(</font>8000<font color="#808080">)</font></font></div> <div>&nbsp;</div> <div><font color="#008000" size="1">-- apply filter<br /> </font><font color="#0000ff"><font size="1">SET</font></font><font size="1"> @SQL <font color="#808080">=</font> </font><font color="#ff0000"><font size="1">'SELECT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TrackingGroupID,<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font size="1">Tag<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font size="1">INTO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #temp<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font size="1">FROM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MyTable<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font size="1">WHERE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1=1 '</font></font><font size="1"> <font color="#808080">+</font> @Where <font color="#808080">+</font> </font><font color="#ff0000"><font size="1">' <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font size="1">GROUP BY&nbsp; TrackingGroupID, Tag'<br /> <br /> </font></font><font color="#008000" size="1">-- apply filter<br /> </font><font color="#0000ff"><font size="1">EXEC</font></font><font size="1"><font color="#808080">(</font>@SQL<font color="#808080">)<br /> <br /> </font></font><font color="#008000" size="1">-- do further manipulation or analysis on #temp table<br /> <font color="#808080" size="2"><font size="1">....</font></font></font><font size="1"><br /> <br /> </font><font color="#008000" size="1">-- drop temp table<br /> </font><font color="#0000ff"><font size="1">DROP</font></font><font size="1"> <font color="#0000ff">TABLE</font> #temp</font><font size="2"></div> </font> <div>&nbsp;</div> <div>But I received this error:</div> <div><font size="1"></font>&nbsp;</div> <div><font size="1">Msg 208, Level 16, State 0, Line 18<br /> Invalid object name '#temp'.</font><font size="1"></div> </font> <div>&nbsp;</div> <div> <div>I knew it was a scoping issue, but I wasn't sure how to work around it exactly. Researching on Google I came across this article:</div> <div>&nbsp;</div> </div> <div><a href="http://blog.shkedy.com/2007/01/temporary-tables-and-dynamic-sql.html" target="_blank">http://blog.shkedy.com/2007/01/temporary-tables-and-dynamic-sql.html</a></div> <div>&nbsp;</div> <div><em>"The problem here is the scope of the session. When we execute dynamic sql via EXEC or sp_executesql a new scope is created for a child session. Any objects created in that session are dropped as soon as the session is closed."</em></div> <div>&nbsp;</div> <div>So I modified my code like so:</div> <div>&nbsp;</div> <div><font color="#008000" size="1">-- create temp table</font></div> <div><font color="#0000ff"><font size="1">CREATE</font></font><font size="1"> <font color="#0000ff">TABLE</font> #temp<br /> </font><font color="#808080" size="1">(<br /> &nbsp;&nbsp;&nbsp;&nbsp; </font><font size="1">TrackingGroupID&nbsp; <font color="#0000ff">INT</font></font><font color="#808080"><font size="1">,<br /> &nbsp;&nbsp;&nbsp;&nbsp; </font></font><font size="1">Tag&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#0000ff">VARCHAR</font><font color="#808080">(</font>50<font color="#808080">)</font> <font color="#808080">NOT</font> <font color="#808080">NULL</font> <font color="#0000ff">DEFAULT</font> <font color="#ff0000">''<br /> </font></font><font color="#808080" size="1">)</font></div> <div>&nbsp;</div> <div><font color="#008000" size="1">-- declare variables<br /> </font><font color="#0000ff"><font size="1">DECLARE</font></font><font size="1"> @SQL <font color="#0000ff">VARCHAR</font><font color="#808080">(</font>8000<font color="#808080">)</font></font></div> <div>&nbsp;</div> <div><font color="#008000" size="1">-- apply filter<br /> </font><font color="#0000ff"><font size="1">SET</font></font><font size="1"> @SQL <font color="#808080">=</font> </font><font color="#ff0000"><font size="1">'INSERT INTO #temp<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font size="1">(TrackingGroupID, Tag)<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font size="1">SELECT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TrackingGroupID,<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font size="1">Tag<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font size="1">FROM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MyTable<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font size="1">WHERE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1=1 '</font></font><font size="1"> <font color="#808080">+</font> @Where <font color="#808080">+</font> </font><font color="#ff0000"><font size="1">' <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font size="1">GROUP BY&nbsp; TrackingGroupID, Tag'</font></font></div> <div>&nbsp;</div> <div><font color="#008000" size="1">-- apply filter<br /> </font><font color="#0000ff"><font size="1">EXEC</font></font><font size="1"><font color="#808080">(</font>@SQL<font color="#808080">)</font></font></div> <div>&nbsp;</div> <div><font color="#008000" size="1"><font color="#008000" size="2"><font size="1">-- do further manipulation or analysis on #temp table<br /> </font></font><font color="#808080" size="2"><font size="1">....</font></font></font></div> <div>&nbsp;</div> <div><font color="#008000" size="1">-- drop temp table<br /> </font><font color="#0000ff"><font size="1">DROP</font></font><font size="1"> <font color="#0000ff">TABLE</font> #temp</font><font size="2"></div> </font> <div>&nbsp;</div> <div>Now I had access to the #temp table throughout the scope of the stored procedure!</div> <div>&nbsp;</div> <div><em>I've been told that ##temp might have solved it also since it's global; however, I'm not as familiar with ## so I didn't go down that road.</em></div>Matt PaveySQL Serverhttp://www.pavey.net/?BlogID=4602008-05-01 08:54:27SQL Server 2008 New DATETIME DataTypeshttp://www.pavey.net/?BlogID=458<em>"The DATETIME function&#8217;s major change in SQL Server 2008 is the four DATETIME data types introduced. They are DATE, TIME, DATETIMEOFFSET and DATETIME2. IN addition to these newly introduced data types, there are new DATETIME functions all well."</em> <p><a href="http://www.sql-server-performance.com/articles/dev/datetime_2008_p1.aspx" target="_blank">http://www.sql-server-performance.com/articles/dev/datetime_2008_p1.aspx</a></p>Matt PaveySQL Serverhttp://www.pavey.net/?BlogID=4582008-04-18 09:46:05SQL Server 2008 Demos and Videoshttp://www.pavey.net/?BlogID=457Learn more about SQL Server 2008 through these demos and videos. <p><a href="http://www.microsoft.com/sqlserver/2008/en/us/demos.aspx" target="_blank">http://www.microsoft.com/sqlserver/2008/en/us/demos.aspx</a></p> I found the <em>Application Development Videos</em> particularly useful.Matt PaveySQL Serverhttp://www.pavey.net/?BlogID=4572008-04-17 21:56:14Enterprise Library 4.0http://www.pavey.net/?BlogID=456<a class="" title="EntLib4.0 March 2008 CTP download site" href="https://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=entlib&amp;ReleaseId=12142" target="_blank">Enterprise Library 4.0 March 2008 CTP download site</a>Matt Pavey.Nethttp://www.pavey.net/?BlogID=4562008-04-02 15:11:06Sys WebForms Page Request Manager Parser Error Exceptionhttp://www.pavey.net/?BlogID=455<div><em>"If you've used the </em><a href="http://ajax.asp.net/" target="_blank"><em>Microsoft ASP.NET AJAX</em></a><em> </em><a href="http://ajax.asp.net/docs/tutorials/UpdatePanelTutorials.aspx" target="_blank"><em>UpdatePanel</em></a><em> control, there's a good chance you've hit the Sys.WebForms.PageRequestManagerParserErrorException error."</em></div> <div><br /> This article provides some details on what this error is, common reasons it occurs, and ways to avoid getting the error.</div> <div>&nbsp;</div> <div><a href="http://weblogs.asp.net/leftslipper/archive/2007/02/26/sys-webforms-pagerequestmanagerparsererrorexception-what-it-is-and-how-to-avoid-it.aspx" target="_blank">http://weblogs.asp.net/leftslipper/archive/2007/02/26/sys-webforms-pagerequestmanagerparsererrorexception-what-it-is-and-how-to-avoid-it.aspx</a></div>Matt PaveyAJAXhttp://www.pavey.net/?BlogID=4552008-03-26 14:57:17MSXML2.ServerXMLHTTPhttp://www.pavey.net/?BlogID=454<div>I don't get to dabble in classic ASP much anymore, which is ok with me, but for the first time in years I had to debug some ASP code this morning to figure out an error for someone who is consuming one of our webservices.</div> <div>&nbsp;</div> <div>The code was as simple as this:</div> <div><font color="#0000ff" size="2"><font size="1"></font></font>&nbsp;</div> <div><font color="#0000ff" size="2"><font size="1">Set</font></font><font size="1"> MyXmlHttp = Server.CreateObject(<font color="#a31515">"MSXML2.ServerXMLHTTP"</font>)<br /> </font><font size="1">MyXmlHttp.open <font color="#a31515">"get"</font>, <font color="#a31515">"https://www.test.com/webservice.asmx/GetSites?StudyID=35"</font>, <font color="#0000ff">False<br /> </font></font><font size="1">MyXmlHttp.setRequestHeader <font color="#a31515">"Content-Type"</font>, <font color="#a31515">"text/xml"<br /> </font></font><font size="1">MyXmlHttp.send()<br /> </font><font size="1">XmlData = MyXmlHttp.responseText</font></div> <div> <p><font size="1">Response.Write(Server.HtmlEncode(XmlData))</font><font size="2"></p> </font></div> <div>The error was:</div> <div>&nbsp;</div> <div><strong>HTTP Error 403.1 - Forbidden: Execute access is denied</strong></div> <div>&nbsp;</div> <div>Can you spot the problem?</div> <div>&nbsp;</div> <div><font size="1">MyXmlHttp.open <font color="#a31515">"GET"</font>, <font color="#a31515">"https://www.test.com/webservice.asmx/GetSites?StudyID=35"</font>, <font color="#0000ff">False</font></font></div> <div>&nbsp;</div> <div>It might not be obvious what I changed, but simply changing the method from "get" to "GET" fixed the problem.</div> <div>&nbsp;</div> <div>I wondered if this was a bug but this MSDN article seems to confirm that the method is case-sensitive and must be in UPPER case.</div> <div>&nbsp;</div> <div><a href="http://msdn2.microsoft.com/en-us/library/ms763809(VS.85).aspx" target="_blank">http://msdn2.microsoft.com/en-us/library/ms763809(VS.85).aspx</a></div> <div>&nbsp;</div> <div><em>"The HTTP method used to open the connection, such as PUT or PROPFIND. For ServerXMLHTTP, this parameter is case-sensitive and the method name must be entered in all upper-case letters."</em></div>Matt PaveyASPhttp://www.pavey.net/?BlogID=4542008-03-14 11:42:48Creating a Data Access Layer with LINQ to SQLhttp://www.pavey.net/?BlogID=453<div>Here's an interesting article regarding the challenges of creating a true data access layer using LINQ to SQL.</div> <div>&nbsp;</div> <div><a href="http://krisvandermotten.wordpress.com/2006/11/30/creating-a-data-access-layer-with-linq-to-sql-part-2/" target="_blank">http://krisvandermotten.wordpress.com/2006/11/30/creating-a-data-access-layer-with-linq-to-sql-part-2/</a></div> <div>&nbsp;</div> <div>It's an older article; however, it covers some interesting questions. I'd recommend in addition to reading the article actually reading through the responses as well at the end of the article.</div> <div>&nbsp;</div> <div><em>"... it is absolutely not clear where a developer should draw the line between what&#8217;s business logic, and what belongs in the DAL ..."</em></div> <div>&nbsp;</div> <div>It seems the primary concerns are what exactly the data access layer should be returning and where exactly the actual query should be executed.</div> <div>&nbsp;</div> <div><em>"That is, the data access layer should be returning just arrays of entities (T[] or IEnumerable). It should [not] be returning IQueryable. Returning IQueryable gives you more rope to hang yourself with because (i) the caller (business logic layer) can redefine the query that ultimately gets sent to the database (ii) the caller (business logic layer) now executes the query because of deferred query execution (iii) the distinction between the caller (business logic layer) and the DAL blurs."</em></div> <div>&nbsp;</div> <div>If you return IQueryable(Of T)&nbsp;objects from the data access layer the queries are not actually getting 'executed' until you use them later, for example when you enumerate over the IQueryable(Of T)&nbsp;data in your business or UI. So by returning&nbsp;List(Of T),&nbsp;IEnumerable(Of T) or an Array&nbsp;of entities you draw a fine line with what the data access layer handles vs. what the business layer or UI handles.</div> <div>&nbsp;</div> <div>I've played around with returning IQueryable(Of T), List(Of T), IEnumerable(Of T)&nbsp;and an Array of entities. Each has their own advantages or caveats. My research so far leads me to believe that IEnumerable(Of T) is the preferred approach.</div> <div>&nbsp;</div> <div><em>"The main design pattern that arises from LINQ is to <strong>prefer IEnumerable(Of T)</strong>. This is because LINQ operates on IEnumerable(Of T), and if you design your application around IEnumerable(Of T), you will find many places where a LINQ query will provide an elegant solution to your problem."</em></div> <div><em></em>&nbsp;</div> <div>Here's a couple articles that discuss IEnumerable(Of T)&nbsp;in more detail:</div> <div>&nbsp;</div> <div><a href="http://www.winterdom.com/weblog/2006/10/13/RediscoveringIEnumerableltTgt.aspx" target="_blank">http://www.winterdom.com/weblog/2006/10/13/RediscoveringIEnumerableltTgt.aspx</a></div> <div>&nbsp;</div> <div><a href="http://jonkruger.com/blog/2007/10/19/iqueryable-vs-ienumerable-in-linq-to-sql-queries/" target="_blank">http://jonkruger.com/blog/2007/10/19/iqueryable-vs-ienumerable-in-linq-to-sql-queries/</a></div> <div>&nbsp;</div> <div>It will be interesting to see how each developer decides to implement LINQ into their projects and how consistent it will be with what others are doing.</div> <div><em></em>&nbsp;</div> <div><em>"I hate it when developers have to make choices like that during routine development. Choosing takes time, and that&#8217;s not likely to improve productivity. But much worse is the fact that different developers will make different choices. Even a single developer may make different choices from one day to the next. That leads to inconsistencies in the code. Developers will spend more time trying to understand the code they&#8217;re reading, because it doesn&#8217;t always follow the same pattern. That&#8217;s bad for productivity. In the worst case scenario, developers start rewriting each other&#8217;s code, just so it matches their choice of the day. That kills productivity."</em></div> <div>&nbsp;</div> <div>I think having a nice set of standards before fully integrating LINQ into a project is going to be a smart move, especially in team environments.</div>Matt PaveyLINQhttp://www.pavey.net/?BlogID=4532008-03-02 11:48:02Extension Methodshttp://www.pavey.net/?BlogID=450<div><em>"Extension methods allow developers to add new methods to the public contract of an existing CLR&nbsp;type, without having to sub-class it or recompile the original type.&nbsp;&nbsp;Extension Methods help blend the flexibility of "duck typing" support popular within dynamic languages today with the performance and compile-time validation of strongly-typed languages."</em></div> <div>&nbsp;</div> <div><a href="http://weblogs.asp.net/scottgu/archive/2007/03/13/new-orcas-language-feature-extension-methods.aspx" target="_blank">http://weblogs.asp.net/scottgu/archive/2007/03/13/new-orcas-language-feature-extension-methods.aspx</a></div>Matt Pavey.Nethttp://www.pavey.net/?BlogID=4502008-02-26 16:42:50LINQ to XMLhttp://www.pavey.net/?BlogID=449<em>"LINQ to XML is a built-in LINQ data provider that is implemented within the "System.Xml.Linq" namespace in .NET 3.5."</em> <p><em>"LINQ to XML provides a clean programming model that enables you to read, construct and write XML data.&nbsp; You can use LINQ to XML to perform LINQ queries over XML that you retrieve from the file-system, from a remote HTTP URL or&nbsp;web-service, or from any in-memory XML content."</em></p> <p><em>"LINQ to XML provides much richer (and easier) querying and data shaping support than the low-level XmlReader/XmlWriter API in .NET today.&nbsp; It also ends up being much more efficient (and uses much less memory) than the DOM API that XmlDocument provides."</em></p> <p><a href="http://weblogs.asp.net/scottgu/archive/2007/08/07/using-linq-to-xml-and-how-to-build-a-custom-rss-feed-reader-with-it.aspx" target="_blank">http://weblogs.asp.net/scottgu/archive/2007/08/07/using-linq-to-xml-and-how-to-build-a-custom-rss-feed-reader-with-it.aspx</a></p>Matt PaveyLINQhttp://www.pavey.net/?BlogID=4492008-02-26 16:32:45LINQ to SQL Debug Visualizerhttp://www.pavey.net/?BlogID=448<em>"One of the nice development features that LINQ to SQL supports is the ability to use a "debug visualizer" to hover over a LINQ expression while&nbsp;in the VS 2008 debugger and inspect the raw SQL that the ORM will ultimately execute at runtime when evaluating the LINQ query expression."</em><br /> <div>&nbsp;</div> <div><a href="http://weblogs.asp.net/scottgu/archive/2007/07/31/linq-to-sql-debug-visualizer.aspx" target="_blank">http://weblogs.asp.net/scottgu/archive/2007/07/31/linq-to-sql-debug-visualizer.aspx</a></div>Matt PaveyLINQhttp://www.pavey.net/?BlogID=4482008-02-26 16:25:10LINQ to SQLhttp://www.pavey.net/?BlogID=446<div class="ExternalClass7293AF08783E406E9840DEB4D2005E59"><em>"Developers can use LINQ with any data source.&nbsp; They can&nbsp;express efficient query behavior in their programming language of choice, optionally transform/shape data query results into whatever format they want, and then easily&nbsp;manipulate the results.&nbsp;&nbsp;LINQ-enabled&nbsp;languages can provide full type-safety and&nbsp;compile-time checking of query expressions, and development tools can provide full&nbsp;intellisense, debugging, and rich refactoring&nbsp;support when writing LINQ code." </em> <div><em>&nbsp;</em></div> <div><em>"LINQ to SQL is an </em><a href="http://en.wikipedia.org/wiki/Object-relational_mapping" target="_blank"><em>O/RM</em></a><em> (object relational mapping) implementation that ships&nbsp;in the .NET Framework "Orcas" release, and which allows you to model&nbsp;a relational database&nbsp;using .NET classes.&nbsp; You can then query the database using LINQ, as well as update/insert/delete data from it."</em></div> <p><em>"LINQ to SQL fully supports transactions, views, and stored procedures.&nbsp; It also provides an easy way to integrate data validation and business logic rules into your data model."</em></p> <div> <li><a href="http://weblogs.asp.net/scottgu/archive/2007/05/19/using-linq-to-sql-part-1.aspx" target="_blank">Part 1: Introduction to LINQ to SQL</a> <li><a href="http://weblogs.asp.net/scottgu/archive/2007/05/29/linq-to-sql-part-2-defining-our-data-model-classes.aspx" target="_blank">Part 2: Defining our Data Model Classes</a> <li><a href="http://weblogs.asp.net/scottgu/archive/2007/06/29/linq-to-sql-part-3-querying-our-database.aspx" target="_blank">Part 3: Querying our Database</a> <li><a href="http://weblogs.asp.net/scottgu/archive/2007/07/11/linq-to-sql-part-4-updating-our-database.aspx" target="_blank">Part 4: Updating our Database</a> <li><a href="http://weblogs.asp.net/scottgu/archive/2007/07/16/linq-to-sql-part-5-binding-ui-using-the-asp-linqdatasource-control.aspx" target="_blank">Part 5: Binding UI using the ASP:LinqDataSource Control</a> <li><a href="http://weblogs.asp.net/scottgu/archive/2007/08/16/linq-to-sql-part-6-retrieving-data-using-stored-procedures.aspx" target="_blank">Part 6: Retrieving Data Using Stored Procedures</a> <li><a href="http://weblogs.asp.net/scottgu/archive/2007/08/23/linq-to-sql-part-7-updating-our-database-using-stored-procedures.aspx" target="_blank">Part 7: Updating our Database using Stored Procedures</a> <li><a href="http://weblogs.asp.net/scottgu/archive/2007/08/27/linq-to-sql-part-8-executing-custom-sql-expressions.aspx" target="_blank">Part 8: Executing Custom SQL Expressions</a> <li><a href="http://weblogs.asp.net/scottgu/archive/2007/09/07/linq-to-sql-part-9-using-a-custom-linq-expression-with-the-lt-asp-linqdatasource-gt-control.aspx" target="_blank">Part 9: Using a Custom LINQ Expression with the &lt;asp:LinqDatasource&gt; control</a> </li> </div> </div> <br />Matt PaveyLINQhttp://www.pavey.net/?BlogID=4462008-02-26 13:37:35The ADO.NET Entity Framework Overviewhttp://www.pavey.net/?BlogID=445<em>"When one takes a look at the amount of code that the average application developer must write to address the impedance mismatch across various data representations (for example objects and relational stores) it is clear that there is an opportunity for improvement. Indeed, there are many scenarios where the right framework can empower an application developer to focus on the needs of the application as opposed to the complexities of bridging disparate data representations."</em> <p><em>"A primary goal of the upcoming version of ADO.NET is to raise the level of abstraction for data programming, thus helping to eliminate the impedance mismatch between data models and between languages that application developers would otherwise have to deal with. Two innovations that make this move possible are Language-Integrated Query and the ADO.NET Entity Framework. The Entity Framework exists as a new part of the ADO.NET family of technologies. ADO.NET will LINQ-enable many data access components: LINQ to SQL, LINQ to DataSet and LINQ to Entities."</em></p> <p><em>"This document describes the ADO.NET Entity Framework, what problem spaces it is targeting and how its various components address those problems."</em></p> <p><a href="http://msdn2.microsoft.com/en-us/library/aa697427(VS.80).aspx" target="_blank">http://msdn2.microsoft.com/en-us/library/aa697427(VS.80).aspx</a></p>Matt PaveyLINQhttp://www.pavey.net/?BlogID=4452008-02-26 13:27:44