<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Eric Fickes &#187; microsoft</title>
	<atom:link href="http://ericfickes.com/category/microsoft/feed/" rel="self" type="application/rss+xml" />
	<link>http://ericfickes.com</link>
	<description>Internets, Databases, Skateboards, Ice Hockeys, and Family</description>
	<lastBuildDate>Thu, 22 Jul 2010 22:45:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Add Eclipse&#8217;s Open Resource to Visual Studio 2010</title>
		<link>http://ericfickes.com/2010/06/add-eclipse-open-resource-to-visual-studio-2010/</link>
		<comments>http://ericfickes.com/2010/06/add-eclipse-open-resource-to-visual-studio-2010/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 19:34:12 +0000</pubDate>
		<dc:creator>Eric Fickes</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[cool]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[tips and tricks]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[msdn]]></category>
		<category><![CDATA[open resource]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[quick open file]]></category>
		<category><![CDATA[visual studio 2010]]></category>
		<category><![CDATA[visual studio gallery]]></category>
		<category><![CDATA[vs gallery]]></category>
		<category><![CDATA[vs plugin]]></category>

		<guid isPermaLink="false">http://ericfickes.com/?p=1500</guid>
		<description><![CDATA[One of my favorite features of the Eclipse IDE is &#8216;Open Resource&#8217; ( Ctrl + Shift + R  ). If you&#8217;re unfamiliar with this, it&#8217;s a File Open dialog that let&#8217;s you type the name of the file you&#8217;re looking for, instead of requiring you to point and click your way to the file. This [...]]]></description>
			<content:encoded><![CDATA[<p>One of my favorite features of the Eclipse IDE is &#8216;Open Resource&#8217; ( Ctrl + Shift + R  ).</p>
<div id="attachment_1501" class="wp-caption aligncenter" style="width: 625px"><a href="http://ericfickes.com/wp-content/uploads/2010/06/eclipse-OpenResource-CtrlShiftR.png" rel="lightbox[1500]"><img class="size-full wp-image-1501" title="Eclipse Open Resrouce dialog" src="http://ericfickes.com/wp-content/uploads/2010/06/eclipse-OpenResource-CtrlShiftR.png" alt="Ctrl + Shift + R &gt; opens this sweet timesaver" width="615" height="515" /></a><p class="wp-caption-text">Don&#39;t point and click to your files, just type their name</p></div>
<p>If you&#8217;re unfamiliar with this, it&#8217;s a File Open dialog that let&#8217;s you type the name of the file you&#8217;re looking for, instead of requiring you to point and click your way to the file.  This is one of the few features I still can&#8217;t believe Visual Studio doesn&#8217;t have built in.  Now I&#8217;ve had other MS experts show me similar &#8220;quick find&#8221; features of Visual Studio, but it&#8217;s still not as easy as Ctrl+Shift+R &gt; type the filename.</p>
<p>When I was using Visual Studio 2008 I came across the <a title="Sonic File Finder is a Visual Studio plugin that gives you Eclipse like 'Open Resource' capability" href="http://www.jens-schaller.de/sonictools/sonicfilefinder/index.htm" target="_blank">Sonic File Finder plugin</a> and I was hooked.  Then I upgraded to Visual Studio 2010 and my plugin went away.  Today I solved my quick open plugin issue by browsing the <a title="Visual Studio Gallery - tools, plugins, and more for Visual Studio" href="http://visualstudiogallery.msdn.microsoft.com/en-us/">Visual Studio Gallery</a> and installing <a title="Quick Open file for Visual Studio 2010" href="http://visualstudiogallery.msdn.microsoft.com/en-us/3eb2f230-2728-4d5f-b448-4c0b64154da7">Quick Open File</a>.  This quick open plugin does exactly what Eclipse&#8217; Open Resource does, and it&#8217;s a good bit simpler than Sonic File Finder.  Now that I&#8217;ve got the plugin installed, the next step is to configure Visual Studio to open this plugin when I hit the Ctrl + Shirt + R keyboard combination.</p>
<h2>Add Ctrl+Shift+R to Visual Studio</h2>
<ol>
<li>Fire up Visual Studio</li>
<li>Click Tools &gt; Options &gt; Environment &gt; Keyboard</li>
<li>You should now be at the window for assigning keyboard shortcuts
<p><img class="aligncenter size-full wp-image-1506" title="Visual Studio &gt; Tools &gt; Options &gt; Environment &gt; Keyboard" src="http://ericfickes.com/wp-content/uploads/2010/06/vs2010-options-keyboard-Quick.png" alt="This is where you edit keyboard shortcuts in Visual Studio" width="771" height="458" /></li>
<li>Type &#8220;Quick&#8221; into the Show commands containing box</li>
<li>Click inside the &#8220;Press shortcut keys&#8221; box, and then press Ctrl + Shift + R on your keyboard</li>
<li>Assuming you&#8217;ve set this to Global, you are now good to go.</li>
</ol>
<p><strong>**NOTE :</strong> When assigning a keyboard shortcut in Visual Studio, you want to make sure your new shortcut isn&#8217;t already assigned to a different command.  If this is the case, you should remove your shortcut assignment from the other command <em>before</em> assigning to your new command.  This dialog will show you what is already assigned to a keyboard combination like so.</p>
<p><a href="http://ericfickes.com/wp-content/uploads/2010/06/vs2010-options-keyboard-Remove.png" rel="lightbox[1500]"><img class="aligncenter size-full wp-image-1507" title="The keyboard shortcut is already assigned to another command" src="http://ericfickes.com/wp-content/uploads/2010/06/vs2010-options-keyboard-Remove.png" alt="Make sure your new shortcut isn't already assigned" width="756" height="438" /></a></p>
<p>Assuming you made it this far, pressing Ctrl + Shift + R in Visual Studio should now show you this Quick File Open dialog.</p>
<p><a href="http://ericfickes.com/wp-content/uploads/2010/06/vs2010-QuickOpenDialog.png" rel="lightbox[1500]"><img class="aligncenter size-full wp-image-1508" title="Visual Studio plugin Quick Open Dialog" src="http://ericfickes.com/wp-content/uploads/2010/06/vs2010-QuickOpenDialog.png" alt="Visual Studio 2010 plugin, 'Quick Open File' dialog box" width="610" height="484" /></a></p>
<p>There you go, quick open in Eclipse <em>and</em> Visual Studio!</p>
]]></content:encoded>
			<wfw:commentRss>http://ericfickes.com/2010/06/add-eclipse-open-resource-to-visual-studio-2010/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>What if you want to PIVOT against a text column?</title>
		<link>http://ericfickes.com/2010/04/what-if-you-want-to-pivot-against-a-text-column/</link>
		<comments>http://ericfickes.com/2010/04/what-if-you-want-to-pivot-against-a-text-column/#comments</comments>
		<pubDate>Sat, 01 May 2010 05:04:27 +0000</pubDate>
		<dc:creator>Eric Fickes</dc:creator>
				<category><![CDATA[database]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[tips and tricks]]></category>
		<category><![CDATA[tsql]]></category>
		<category><![CDATA[coalesce]]></category>
		<category><![CDATA[dynamic sql]]></category>
		<category><![CDATA[exec]]></category>
		<category><![CDATA[pivot]]></category>
		<category><![CDATA[quotename]]></category>
		<category><![CDATA[SQLSERVER]]></category>
		<category><![CDATA[table variable]]></category>

		<guid isPermaLink="false">http://ericfickes.com/?p=1435</guid>
		<description><![CDATA[If you&#8217;ve ever worked with or researched SQL Server&#8217;s PIVOT function, you probably noticed most of the samples pivot against an id column.  Typically an int column like EmployeeID, or StoreID.  That&#8217;s fine and dandy, but what happens when you want to PIVOT against a varchar column?  If you&#8217;ve been in this need you know [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve ever worked with or researched SQL Server&#8217;s <a title="Using PIVOT and UNPIVOT functions" href="http://msdn.microsoft.com/en-us/library/ms177410.aspx" target="_blank">PIVOT function</a>, you probably noticed most of the samples pivot against an id column.  Typically an int column like EmployeeID, or StoreID.  That&#8217;s fine and dandy, but what happens when you want to PIVOT against a varchar column?  If you&#8217;ve been in this need you know this is a bit of a task.</p>
<p>I had this need on an app recently and built a little dynamic sql action that does just this.  The example below however, uses the the <a title="DatabaseLog table in the AdventureWorks DB" href="http://msdn.microsoft.com/en-us/library/ms124872.aspx" target="_blank">DatabaseLog</a> table in the <a title="Download AdventureWorks sample databases for free" href="http://msdn.microsoft.com/en-us/library/ms124501(v=SQL.100).aspx" target="_blank">AdventureWorks sample database</a> to return a count of Events logged for each Schema.  Before jumping into the PIVOT, here&#8217;s a simple query that gives you the same information, all Schemas, Events, and Event counts.</p>
<pre class="brush: sql;">
SELECT      [Schema], [Event], COUNT( [Event] ) AS 'event_count'
FROM        DatabaseLog
GROUP BY    [Schema], [Event]
ORDER BY    [Schema]
</pre>
<p>Running this query should give you a long result looking something like this.</p>
<p><a href="http://ericfickes.com/wp-content/uploads/2010/04/regular_count_query.png" rel="lightbox[1435]"><img class="aligncenter size-full wp-image-1442" title="Regular COUNT query" src="http://ericfickes.com/wp-content/uploads/2010/04/regular_count_query.png" alt="Data is there, format isn't nice like PIVOT" width="409" height="394" /></a></p>
<p>While this query returns the same information to you, I don&#8217;t like this format as much as using PIVOT.  This query result is long and requires a bit of manipulation to get into a readable format.</p>
<p>Now let&#8217;s have a look at retrieving the same information using the PIVOT function.</p>
<pre class="brush: sql;">
/*
Example of a dynamic PIVOT against a varchar column from the Adventureworks database

References :
PIVOT &amp; UNPIVOT function

http://msdn.microsoft.com/en-us/library/ms177410.aspx

AdventureWorks sample Databases

http://msdn.microsoft.com/en-us/library/ms124501(v=SQL.100).aspx

AdventreWorks.DatabaseLog

http://msdn.microsoft.com/en-us/library/ms124872.aspx

*/

USE AdventureWorks

-- populate temp Event table
SELECT DISTINCT [Event] as 'Event'
INTO	#events
FROM	DatabaseLog

-- this var will hold a comma delimited list of [Event]
DECLARE	@eventList nvarchar(max)

-- create a flattened [Event], list for the PIVOT statement
SELECT	@eventList = COALESCE( @eventList + ', ', '') + CAST( QUOTENAME( [Event] ) AS VARCHAR(1000) )
FROM	#events
ORDER BY [Event]

-- drop table var since our data now lives in @eventList
DROP TABLE #events

-- this var will hold the dynamic PIVOT sql
DECLARE @pvt_sql nvarchar(max)

-- NOTE : we're using dynamic sql here because PIVOT
-- does not support sub SELECT in the 'FOR Event IN ( )'
-- part of the query.
-- If we don't use dynamic SQL here, the PIVOT function
-- requires you to hard code each 'Event'
-- Using SELECT * here so the [Event] columns are auto included
SET @pvt_sql = 'SELECT	*
                FROM
                (
                    SELECT	[Event], [Schema]
                    FROM	DatabaseLog
                ) AS data
                PIVOT
                (
                    COUNT( Event )
                    FOR Event IN
                    ( ' + @eventList + ' )
                ) AS pvt'

-- run the query
EXEC sp_executesql @pvt_sql
</pre>
<p>Assuming you have the AdventureWorks database installed on your server, running this sql should give you a result looking something like this.</p>
<div id="attachment_1439" class="wp-caption aligncenter" style="width: 597px"><a href="http://ericfickes.com/wp-content/uploads/2010/04/dynamic_pivot_dblog.png" rel="lightbox[1435]"><img class="size-full wp-image-1439" title="Schema Event counts" src="http://ericfickes.com/wp-content/uploads/2010/04/dynamic_pivot_dblog.png" alt="Dynamic PIVOT on text column Event" width="587" height="143" /></a><p class="wp-caption-text">Show all Schemas and count of each Event type</p></div>
<p>This query result was truncated to fit in this post, but just know the query above creates a column for every Event in the Databaselog table.</p>
<p>A quick explanation of what&#8217;s happening in this sql</p>
<ol>
<li>First you fill a table variable ( #events ) with all Events from DatabaseLog</li>
<li>Next create a comma delimited list of the Events inside of the table variable</li>
<li>Drop the table variable now that we&#8217;ve got our delimited list of Events</li>
<li>Build the PIVOT statement as a string so you can inject the Events list</li>
<li>Fire the dynamic SQL via EXEC</li>
</ol>
<p>Dynamic SQL is something that comes in handy from time to time, but I do my best to only use it if I absolutely have to.  In this case we&#8217;re using it because the PIVOT function does not allow sub SELECT statements.  This is also why we create a specially formatted delimited list of Events prior to building the dynamic sql.</p>
<p>So there you have it, one example of using PIVOT against a varchar column instead of an integer column.  Also, this is a pretty good example of a dynamic PIVOT since it&#8217;s pretty simple.  I hope this makes sense, and if you have any suggestions of better techniques, I&#8217;d love to hear it.</p>
]]></content:encoded>
			<wfw:commentRss>http://ericfickes.com/2010/04/what-if-you-want-to-pivot-against-a-text-column/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Weird, that bat file path doesn&#8217;t jive from the toolbar</title>
		<link>http://ericfickes.com/2010/04/weird-that-bat-file-path-doesnt-jive-from-the-toolbar/</link>
		<comments>http://ericfickes.com/2010/04/weird-that-bat-file-path-doesnt-jive-from-the-toolbar/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 06:20:56 +0000</pubDate>
		<dc:creator>Eric Fickes</dc:creator>
				<category><![CDATA[command line]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[ramblings]]></category>
		<category><![CDATA[random]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[Adobe Version Cue]]></category>
		<category><![CDATA[bat]]></category>
		<category><![CDATA[batch]]></category>
		<category><![CDATA[cmd]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[Folder Toolbar]]></category>
		<category><![CDATA[path]]></category>
		<category><![CDATA[Windows7]]></category>

		<guid isPermaLink="false">http://ericfickes.com/?p=1430</guid>
		<description><![CDATA[I just noticed something when running some batch files on Windows 7. If I launch the file from Windows Explorer, the path in the command window matches the location of the batch file. However, I typically launch my batch files from a toolbar on my taskbar that points to the same folder.  The batch file [...]]]></description>
			<content:encoded><![CDATA[<p>I just noticed something when running some batch files on Windows 7.  If I launch the file from Windows Explorer, the path in the command window matches the location of the batch file.</p>
<div id="attachment_1431" class="wp-caption aligncenter" style="width: 440px"><a href="http://ericfickes.com/wp-content/uploads/2010/04/bat-explorer-matching.png" rel="lightbox[1430]"><img class="size-full wp-image-1431" title="Paths match" src="http://ericfickes.com/wp-content/uploads/2010/04/bat-explorer-matching.png" alt="Bat file path and cmd paths match when you double click it" width="430" height="378" /></a><p class="wp-caption-text">The paths, they match!</p></div>
<p>However, I typically launch my batch files from a toolbar on my taskbar that points to the same folder.  The batch file still works, but the path shown in the command window is weird.  I have no idea how an Adobe Version Cue path could get injected, but it does.</p>
<div id="attachment_1432" class="wp-caption aligncenter" style="width: 691px"><a href="http://ericfickes.com/wp-content/uploads/2010/04/bat-toolbar-weird.png" rel="lightbox[1430]"><img class="size-full wp-image-1432" title="How did Adobe Version Cue get into there?" src="http://ericfickes.com/wp-content/uploads/2010/04/bat-toolbar-weird.png" alt="Launching a bat from a toolbar injects a path to Adobe Version Cue?" width="681" height="573" /></a><p class="wp-caption-text">Weird paths</p></div>
<p>To capture both shots of the command window I had to hit Pause.  These aren&#8217;t faked, they&#8217;re just completely random.</p>
]]></content:encoded>
			<wfw:commentRss>http://ericfickes.com/2010/04/weird-that-bat-file-path-doesnt-jive-from-the-toolbar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DataBind a List of custom classes to an ASP:ListBox control</title>
		<link>http://ericfickes.com/2010/04/databind-a-list-of-custom-classes-to-an-asplistbox-control/</link>
		<comments>http://ericfickes.com/2010/04/databind-a-list-of-custom-classes-to-an-asplistbox-control/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 20:09:16 +0000</pubDate>
		<dc:creator>Eric Fickes</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[tips and tricks]]></category>
		<category><![CDATA[.NET framework]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[auto-implemented]]></category>
		<category><![CDATA[auto-implemented-properties]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[custom class]]></category>
		<category><![CDATA[DataBind]]></category>
		<category><![CDATA[DataSource]]></category>
		<category><![CDATA[properties]]></category>
		<category><![CDATA[VO]]></category>

		<guid isPermaLink="false">http://ericfickes.com/?p=1415</guid>
		<description><![CDATA[Recently I was scratching my head at this error from the .NET Framework DataBinding: &#8216;MyApp.vo.customVO&#8217; does not contain a property with the name &#8216;Name&#8217; I was stumped because my custom VO class did in fact have a public property called Name.  After many trials and tribulations I figured out that .NET didn&#8217;t like how I [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I was scratching my head at this error from the .NET Framework</p>
<blockquote>
<h3><em><em>DataBinding: &#8216;MyApp.vo.customVO&#8217; does not contain a property with the name &#8216;Name&#8217;</em></em></h3>
</blockquote>
<p>I was stumped because my custom VO class did in fact have a public property called Name.  After many trials and tribulations I figured out that .NET didn&#8217;t like how I structured my custom class.</p>
<p>Here is what my original custom class looked like.</p>
<pre class="brush: csharp;">
namespace MyApp.vo
{
    public class customVO
    {
        public Int32 id  = 0;
        public DateTime time  = new DateTime();
        public string Name  = string.Empty;
        public string DeviceType  = string.Empty;
        public string ObjectIDs  = string.Empty;
    }
}
</pre>
<p>Luckily I have <a title="JetBrain's ReSharper is a must have for any .NET developer" href="http://www.jetbrains.com/resharper/" target="_blank">JetBrains ReSharper</a> installed, and it suggested using C#&#8217;s <a href="http://msdn.microsoft.com/en-us/library/bb384054.aspx" target="_blank">Auto-Implemented properties</a>.  This is the one thing I hadn&#8217;t thought about trying, and it ended up being the fix!  My new custom VO class now looks like this.</p>
<pre class="brush: csharp;">
namespace MyApp.vo
{
    public class customVO
    {
        public Int32 id { get; set; }
        public DateTime time { get; set; }
        public string DeviceType { get; set; }
        public string ObjectIDs { get; set; }
        public string Name { get; set; }
    }
}
</pre>
<p>So if you find yourself running into this error while trying to DataBind a collection of custom classes to a ListBox or similar control, have a look at your custom class and see if you can convert it over to using auto-implement properties as well.</p>
<p>Now I&#8217;m not suggesting this is the only way to DataBind a List of custom classes to a ListBox, but it solved my problem and let me do direct databinding from my service call without having to do any pre-processing on my list.</p>
<p>Hope this helps someone else.</p>
]]></content:encoded>
			<wfw:commentRss>http://ericfickes.com/2010/04/databind-a-list-of-custom-classes-to-an-asplistbox-control/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Incorrect syntax near the keyword &#8216;table&#8217; in TSQL</title>
		<link>http://ericfickes.com/2010/04/incorrect-syntax-near-the-keyword-table-in-tsql/</link>
		<comments>http://ericfickes.com/2010/04/incorrect-syntax-near-the-keyword-table-in-tsql/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 22:18:21 +0000</pubDate>
		<dc:creator>Eric Fickes</dc:creator>
				<category><![CDATA[database]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[tsql]]></category>
		<category><![CDATA[#table]]></category>
		<category><![CDATA[DECLARE]]></category>
		<category><![CDATA[SQLSERVER]]></category>
		<category><![CDATA[SQLSERVER 2005]]></category>
		<category><![CDATA[table variable]]></category>

		<guid isPermaLink="false">http://ericfickes.com/2010/04/incorrect-syntax-near-the-keyword-table-in-tsql/</guid>
		<description><![CDATA[Ran into something little that I know I&#8217;m going to forget if I don&#8217;t write down. It appears that when using a TABLE variable in tsql ( SQL Server 2005 ), you must DECLARE that variable on it&#8217;s own line, as opposed to inline with your other @variables. Typically in my sprocs or sql scripts [...]]]></description>
			<content:encoded><![CDATA[<p>Ran into something little that I know I&#8217;m going to forget if I don&#8217;t write down.  It appears that when using a TABLE variable in tsql ( SQL Server 2005 ), you must DECLARE that variable on it&#8217;s own line, as opposed to inline with your other @variables.</p>
<p>Typically in my sprocs or sql scripts I do my best to have a main DECLARE block and seperate my @variables with a comma like this.</p>
<div id="attachment_1412" class="wp-caption aligncenter" style="width: 378px"><a href="http://ericfickes.com/wp-content/uploads/2010/04/declare-bad.png" rel="lightbox[1414]"><img class="size-full wp-image-1412" title="Incorrect syntax near the keyword 'table'" src="http://ericfickes.com/wp-content/uploads/2010/04/declare-bad.png" alt="Typically I DECLARE=" width="368" height="125" /></a><p class="wp-caption-text">If you&#39;re using a TABLE variable, put it on it&#39;s own DECLARE line</p></div>
<p>After some mucking around, it turns out moving the TABLE @variable to it&#8217;s own DECLARE line fixes this issue.</p>
<div id="attachment_1413" class="wp-caption aligncenter" style="width: 304px"><a href="http://ericfickes.com/wp-content/uploads/2010/04/declare-good.png" rel="lightbox[1414]"><img class="size-full wp-image-1413" title="DECLARE TABLE @variables on their own line" src="http://ericfickes.com/wp-content/uploads/2010/04/declare-good.png" alt="DECLARE TABLE @variables on their own line" width="294" height="106" /></a><p class="wp-caption-text">DECLARE TABLE @variables on their own line</p></div>
<p>I haven&#8217;t found this info in SQL BOL, so I hope this helps somebody else.</p>
]]></content:encoded>
			<wfw:commentRss>http://ericfickes.com/2010/04/incorrect-syntax-near-the-keyword-table-in-tsql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to TWEET from a SQL CLR Stored Procedure</title>
		<link>http://ericfickes.com/2010/03/how-to-tweet-from-a-sql-crl-stored-procedure/</link>
		<comments>http://ericfickes.com/2010/03/how-to-tweet-from-a-sql-crl-stored-procedure/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 01:10:58 +0000</pubDate>
		<dc:creator>Eric Fickes</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[tips and tricks]]></category>
		<category><![CDATA[tsql]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[.net assembly]]></category>
		<category><![CDATA[.net Common Language Runtime]]></category>
		<category><![CDATA[CLR]]></category>
		<category><![CDATA[CLR SPROC]]></category>
		<category><![CDATA[sproc]]></category>
		<category><![CDATA[sql server 2005]]></category>
		<category><![CDATA[stored procedure]]></category>
		<category><![CDATA[tweet]]></category>

		<guid isPermaLink="false">http://ericfickes.com/?p=1133</guid>
		<description><![CDATA[Here&#8217;s another SQL Server 2005 geek out moment, a CLR SPROC that tweets to Twitter. Big shoutout to Danny Battison for sharing the C# code to post to Twitter. This is what got me started on the C# side of things.  Also, you can skip all my ramblings here and just download code here and [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s another SQL Server 2005 geek out moment, a CLR SPROC that tweets to Twitter.  Big shoutout to <a title="Danny Battison is a C# rocker!" href="http://www.dreamincode.net/code/snippet2556.htm" target="_blank">Danny Battison for sharing the C# code to post to Twitter</a>.  This is what got me started on the C# side of things.  Also, you can skip all my ramblings here and just <a title="CLR SPROC &gt; Tweetsproc sample code" href="http://ericfickes.com/code/tweetsproc.zip" target="_blank">download code here</a> and fire it up.  The zip file contains all the source code, the compiled assembly file, and install.sql that shows you how to hook this up.</p>
<p>Being the SQL junky that I am, I was interested in trying out SQL Server&#8217;s new  <a title="CLR Stored Procedures on MSDN" href="http://msdn.microsoft.com/en-us/library/ms131094.aspx" target="_blank">CLR Stored Procedures</a>.  A CLR sproc is a stored procedure that is able to use .net code that you&#8217;ve compiled into an assembly file.  For you classic ASP heads out there, think of the ASP page being the sproc, and the .net assembly being your COM object ( cringe, let&#8217;s talk about classic ASP ).  While there are plenty of great articles on <a title="Writing CLR Stored Procedures on SQLTEAM.com" href="http://www.sqlteam.com/article/writing-clr-stored-procedures-in-charp-introduction-to-charp-part-1" target="_blank">writing CLR stored procedures</a>, I&#8217;m going to breeze through the code that makes up this project.</p>
<h2>First make a .net class library that will be compiled into an assembly file.</h2>
<pre class="brush: csharp;">
using System;
using Microsoft.SqlServer.Server;
using System.Data.SqlTypes;
using System.Net;
using System.IO;
using System.Text.RegularExpressions;

/// &lt;summary&gt;
/// This assembly will be used by a SQL2005 SPROC to communicate
/// with twitter.com
/// &lt;/summary&gt;
public sealed class tweetsproc
{
    /*
     * TWITTER CODE BORROWED FROM :
     *  http://www.dreamincode.net/code/snippet2556.htm
     *
     * A function to post an update to Twitter programmatically
     * Author: Danny Battison
     * Contact: gabehabe@hotmail.com
     */

    /// &lt;summary&gt;
    /// Post an update to a Twitter acount
    /// &lt;/summary&gt;
    /// &lt;param name=&quot;username&quot;&gt;The username of the account&lt;/param&gt;
    /// &lt;param name=&quot;password&quot;&gt;The password of the account&lt;/param&gt;
    /// &lt;param name=&quot;tweet&quot;&gt;The status to post&lt;/param&gt;
    [Microsoft.SqlServer.Server.SqlProcedure(Name = &quot;PostTweet&quot;)]
    //public static void PostTweet( string username, string password, string tweet)
    public static void PostTweet(   SqlString username,
                                    SqlString password,
                                    SqlString tweet)
    {
        try
        {
            // encode the username/password
            string user = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(username.ToString() + &quot;:&quot; + password.ToString()));
            // determine what we want to upload as a status
            byte[] bytes = System.Text.Encoding.ASCII.GetBytes(&quot;status=&quot; + tweet.ToString());

            // Create a WebPermission.
            WebPermission myWebPermission1 = new WebPermission();

            // Allow Connect access to the specified URLs.
            myWebPermission1.AddPermission(NetworkAccess.Connect,new Regex(&quot;http://www\\.twitter\\.com/.*&quot;,
              RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline));

            myWebPermission1.Demand();

            // connect with the update page
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(&quot;http://twitter.com/statuses/update.xml&quot;);

            // set the method to POST
            request.Method = &quot;POST&quot;;
            request.ServicePoint.Expect100Continue = false; // thanks to argodev for this recent change!
            // set the authorisation levels
            request.Headers.Add(&quot;Authorization&quot;, &quot;Basic &quot; + user);
            request.ContentType = &quot;application/x-www-form-urlencoded&quot;;
            // set the length of the content
            request.ContentLength = bytes.Length;

            // set up the stream
            Stream reqStream = request.GetRequestStream();
            // write to the stream
            reqStream.Write(bytes, 0, bytes.Length);
            // close the stream
            reqStream.Close();

            // Let's get the Response from Twitter
            var webresp = request.GetResponse();
            // Let's read the Response
            var sread = new StreamReader( webresp.GetResponseStream() );

            // Use SqlContext to return data to the QueryAnalyzer results window
            SqlContext.Pipe.Send( sread.ReadToEnd() );

        }
        catch (Exception exc)
        {
            // send error back
            SqlContext.Pipe.Send(exc.Message);
        }
    }
}
</pre>
<h3>Here&#8217;s the app.config for this assembly.</h3>
<pre class="brush: xml;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
&lt;configuration&gt;
  &lt;system.web&gt;
    &lt;trust level=&quot;Full&quot; processRequestInApplicationTrust=&quot;true&quot; originUrl=&quot;&quot; /&gt;
  &lt;/system.web&gt;
&lt;/configuration&gt;
</pre>
<p>Once you build this project, you should have your assembly ( tweetsproc.dll ) which will be used by your CLR Sproc.  Now it&#8217;s time to do some SQL server work.</p>
<h2>Enable CLR access for SQL server</h2>
<pre class="brush: sql;">
EXEC sp_configure @configname = 'clr enabled', @configvalue = 1
RECONFIGURE WITH OVERRIDE
GO
</pre>
<h2>Create the SQL Assembly</h2>
<pre class="brush: sql;">
CREATE ASSEMBLY tweetsproc_clr_assembly from 'C:\Users\eric\Desktop\blog\tweetsproc.dll'
WITH PERMISSION_SET = EXTERNAL_ACCESS
GO
</pre>
<h2>Create your SPROC</h2>
<pre class="brush: sql;">
CREATE PROC tweetsproc_tweet(	@username as nvarchar(50),
								@password as nvarchar(50),
								@tweet as nvarchar(140)
							)
AS
	-- [Assembly Name].[Class Name].[CLR function Name]
	EXTERNAL NAME tweetsproc_clr_assembly.tweetsproc.PostTweet
GO
</pre>
<h2>Tweet from a sproc</h2>
<pre class="brush: sql;">EXEC tweetsproc_tweet 'TwitterUsername', 'TwitterPassword', 'Hey @ericfickes, I''m tweeting from my database too!'</pre>
<p>Running this sproc returns the XML response from Twitter.</p>
<div id="attachment_1142" class="wp-caption aligncenter" style="width: 678px"><a href="http://ericfickes.com/wp-content/uploads/2010/03/tweetsproc_tweet-response1.png" rel="lightbox[1133]"><img class="size-full wp-image-1142" title="Twitter response from tweet sproc" src="http://ericfickes.com/wp-content/uploads/2010/03/tweetsproc_tweet-response1.png" alt="Twitter response from tweet sproc" width="668" height="719" /></a><p class="wp-caption-text">Tweetsproc returns the full Twitter response</p></div>
<p>That&#8217;s one sample CLR SPROC in the bank!  Feel free to download this code and try it out yourself.  I&#8217;d love to get some feedback on anybody looking to use this for real.  While tweeting from a stored procedure probably isn&#8217;t a hot topic for anybody, this is a nice teaser for what you can do with CLR sprocs now.</p>
<p><a title="CLR SPROC &gt; Tweetsproc sample code" href="http://ericfickes.com/code/tweetsproc.zip" target="_blank">Download code here.</a></p>
<p>Inside this zip you&#8217;ll find this.</p>
<ul>
<li>install.sql is everything you need to install this on your database</li>
<li>tweetsproc.dll is the twitter assembly used by the sproc</li>
<li>tweetsproc folder is the .net class library project</li>
</ul>
<div id="attachment_1139" class="wp-caption aligncenter" style="width: 289px"><a href="http://ericfickes.com/wp-content/uploads/2010/03/tweetsproczip.png" rel="lightbox[1133]"><img class="size-full wp-image-1139" title="Contents of tweetsproc.zip" src="http://ericfickes.com/wp-content/uploads/2010/03/tweetsproczip.png" alt="Contents of tweetsproc.zip" width="279" height="114" /></a><p class="wp-caption-text">Everything you need to get TWEETING from a sproc</p></div>
]]></content:encoded>
			<wfw:commentRss>http://ericfickes.com/2010/03/how-to-tweet-from-a-sql-crl-stored-procedure/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Coldfusion and ASP.NET coexisting on IIS, where&#8217;d WebResource.axd go?</title>
		<link>http://ericfickes.com/2010/02/coldfusion-and-asp-net-coexisting-on-iis-whered-webresource-axd-go/</link>
		<comments>http://ericfickes.com/2010/02/coldfusion-and-asp-net-coexisting-on-iis-whered-webresource-axd-go/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 19:33:39 +0000</pubDate>
		<dc:creator>Eric Fickes</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[coldfusion]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[tips and tricks]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[iis7]]></category>
		<category><![CDATA[inetmgr]]></category>
		<category><![CDATA[web.config]]></category>
		<category><![CDATA[webresource.axd]]></category>

		<guid isPermaLink="false">http://ericfickes.com/?p=1109</guid>
		<description><![CDATA[My Monday morning WTF comes from IIS7 on Windows 7.  I recently installed Coldfusion9 on this machine which has a handful of existing ASP.NET 3.5 web applications.  The problem I ran into came after installing Coldfusion9 and electing to configure all IIS websites to work with CF.  While that is convenient, it ended up breaking [...]]]></description>
			<content:encoded><![CDATA[<p>My Monday morning WTF comes from IIS7 on Windows 7.  I recently installed Coldfusion9 on this machine which has a handful of existing ASP.NET 3.5 web applications.  The problem I ran into came after installing Coldfusion9 and electing to configure all IIS websites to work with CF.  While that is convenient, it ended up breaking one of my ASP.NET applications that was using ASP Validation controls on a login form.  Now that things are figured out, here are the details.</p>
<p>Firing up my ASP.NET application gives me the error message :</p>
<p style="text-align: center;"><strong>The WebResource.axd handler must be registered in the configuration to process this request</strong></p>
<div id="attachment_1110" class="wp-caption aligncenter" style="width: 310px"><a href="http://ericfickes.com/wp-content/uploads/2010/02/axd-handler-error.png" rel="lightbox[1109]"><img class="size-medium wp-image-1110" title="WebResource.axd handler must be registered" src="http://ericfickes.com/wp-content/uploads/2010/02/axd-handler-error-300x177.png" alt="Misleading web handler error message" width="300" height="177" /></a><p class="wp-caption-text">WebResource.axd handler must be registered</p></div>
<p>Obviously all I could think is WTF?!?!? since this application worked on Friday and now it is broken.  The first thing I want to point out is that in my situation, the suggested solution of mapping WebResource.axd in the httpHandlers section of my web.config did <em><strong>not</strong></em> help this problem.  After some googling I cam across <a title="Problems with ASP.NET 2.0 Applications with Validation Controls" href="http://forums.iis.net/p/1147595/1861983.aspx#1861983" target="_blank">this post on the IIS.NET forums</a> which put me on the right track.  You can read the details there if you want a good background on MS&#8217; response and other users running CF and ASP.NET on the same box.</p>
<p>I&#8217;m happy to say I have three workarounds for this issue.  Hopefully these will help you as well.</p>
<h3>1. Change your AppPool to run in Classic Mode</h3>
<ol>
<li>In inetmgr, put your web application into it&#8217;s own Application Pool ( unless it&#8217;s already in it&#8217;s own pool )</li>
<li>Change that AppPool&#8217;s Managed pipeline mode to &#8220;Classic&#8221;</li>
<li>You should be good to go</li>
</ol>
<div id="attachment_1111" class="wp-caption aligncenter" style="width: 310px"><a href="http://ericfickes.com/wp-content/uploads/2010/02/change-apppool-2-classic.png" rel="lightbox[1109]"><img class="size-medium wp-image-1111" title="Edit Application Pool &gt; Managed Pipeline Mode" src="http://ericfickes.com/wp-content/uploads/2010/02/change-apppool-2-classic-300x266.png" alt="Change Managed Pipeline Mode to Classic" width="300" height="266" /></a><p class="wp-caption-text">Classic mode is for compatibility ( think IIS6 )</p></div>
<h3>2. Stop using ASP Validation controls</h3>
<p>All ASP.NET Validation controls are hosted by WebResource.axd.  If you stop using ASP Validator controls, the server will stop asking for WebResource.axd.</p>
<div id="attachment_1112" class="wp-caption aligncenter" style="width: 301px"><a href="http://ericfickes.com/wp-content/uploads/2010/02/stop-using-validators.png" rel="lightbox[1109]"><img class="size-medium wp-image-1112" title="Don't use ASP Validator controls" src="http://ericfickes.com/wp-content/uploads/2010/02/stop-using-validators-291x300.png" alt="Comment out ASP Validator controls" width="291" height="300" /></a><p class="wp-caption-text">Removing ASP Validator controls should remove this error</p></div>
<h3>3. Remove Coldfusion handler mappings from your ASP.NET site</h3>
<p>If your ASP.NET app isn&#8217;t using Coldfusion, I would suggest doing this as your solution.  Even if you do need Coldfusion in your ASP.NET app, you could still host your CF app in it&#8217;s own Virtual Directory and request if via ASP.NET.</p>
<ol>
<li>Open inetmgr</li>
<li>Select your web app on the left ( under Default Web Site )</li>
<li>In Features View on the right, double click Handler Mappings</li>
<li>Sort your Handler Mappings by Name, and remove all entries titled &#8220;AboMapperCustom-*&#8221;</li>
<li>Now your ASP.NET should work like a champ.</li>
</ol>
<div id="attachment_1113" class="wp-caption aligncenter" style="width: 310px"><a href="http://ericfickes.com/wp-content/uploads/2010/02/inetmgr-handlerMappings.png" rel="lightbox[1109]"><img class="size-medium wp-image-1113" title="inetmgr Handler Mappings" src="http://ericfickes.com/wp-content/uploads/2010/02/inetmgr-handlerMappings-300x238.png" alt="IIS7 inetmgr Handler Mappings" width="300" height="238" /></a><p class="wp-caption-text">IIS7 Handler Mappings</p></div>
<div id="attachment_1114" class="wp-caption aligncenter" style="width: 310px"><a href="http://ericfickes.com/wp-content/uploads/2010/02/remove-cf-mappings.png" rel="lightbox[1109]"><img class="size-medium wp-image-1114" title="Coldfusion9 Handler Mappings" src="http://ericfickes.com/wp-content/uploads/2010/02/remove-cf-mappings-300x242.png" alt="Coldfusion9 Handler Mappings" width="300" height="242" /></a><p class="wp-caption-text">Coldfusion9 Handler Mappings</p></div>
<p>Monday WTF solved.  Now to get back to pushing buttons.</p>
]]></content:encoded>
			<wfw:commentRss>http://ericfickes.com/2010/02/coldfusion-and-asp-net-coexisting-on-iis-whered-webresource-axd-go/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Does SQL Server Management Studio truncate your results?</title>
		<link>http://ericfickes.com/2010/02/does-sql-server-management-studio-truncate-your-results/</link>
		<comments>http://ericfickes.com/2010/02/does-sql-server-management-studio-truncate-your-results/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 17:52:28 +0000</pubDate>
		<dc:creator>Eric Fickes</dc:creator>
				<category><![CDATA[database]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[tips and tricks]]></category>
		<category><![CDATA[tsql]]></category>
		<category><![CDATA[column size]]></category>
		<category><![CDATA[max characters]]></category>
		<category><![CDATA[query]]></category>
		<category><![CDATA[results to text]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[sql server management studio]]></category>
		<category><![CDATA[truncated results]]></category>

		<guid isPermaLink="false">http://ericfickes.com/?p=1103</guid>
		<description><![CDATA[Ever work with query results that are so long SQL Server Management Studio truncates the results? I ran into this issue recently while running some utility sprocs that generate C# code for me.  I was thinking I&#8217;d have to refactor my sprocs, but then I found this helpful setting under Query Options. This solved my [...]]]></description>
			<content:encoded><![CDATA[<p>Ever work with query results that are so long SQL Server Management Studio truncates the results?</p>
<div id="attachment_1104" class="wp-caption aligncenter" style="width: 567px"><a href="http://ericfickes.com/wp-content/uploads/2010/02/1.truncated-result.png" rel="lightbox[1103]"><img class="size-full wp-image-1104" title="Results to text are truncated" src="http://ericfickes.com/wp-content/uploads/2010/02/1.truncated-result.png" alt="truncated query results" width="557" height="408" /></a><p class="wp-caption-text">sproc results are truncated</p></div>
<p>I ran into this issue recently while running some utility sprocs that generate C# code for me.  I was thinking I&#8217;d have to refactor my sprocs, but then I found this helpful setting under Query Options.</p>
<div id="attachment_1107" class="wp-caption aligncenter" style="width: 673px"><a href="http://ericfickes.com/wp-content/uploads/2010/02/2.qry-max-char1.png" rel="lightbox[1103]"><img class="size-full wp-image-1107" title="Query Options Dialog" src="http://ericfickes.com/wp-content/uploads/2010/02/2.qry-max-char1.png" alt="This is the Query Options dialog" width="663" height="401" /></a><p class="wp-caption-text">Update Max.num characters per column in Query Options &gt; Results &gt; Text</p></div>
<p>This solved my problem and will hopefully solve yours as well.</p>
<ol>
<li>Right click the query editor</li>
<li>Left click &#8220;Query Options&#8230;&#8221;</li>
<li>Expand Results in the tree on the left ( in popup dialog )</li>
<li>Click on Text under Results</li>
<li>Set &#8220;Maximum number of characters displayed in each column&#8221; to a number large enough to see all your results.</li>
</ol>
<p>Quick and easy, hope I remember this setting.</p>
]]></content:encoded>
			<wfw:commentRss>http://ericfickes.com/2010/02/does-sql-server-management-studio-truncate-your-results/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to JOIN two tables using LINQ to SQL</title>
		<link>http://ericfickes.com/2010/02/how-to-join-two-tables-using-linq-to-sql/</link>
		<comments>http://ericfickes.com/2010/02/how-to-join-two-tables-using-linq-to-sql/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 01:27:53 +0000</pubDate>
		<dc:creator>Eric Fickes</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[tips and tricks]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[join]]></category>
		<category><![CDATA[linq]]></category>
		<category><![CDATA[linq to sql]]></category>
		<category><![CDATA[linqtosql]]></category>
		<category><![CDATA[query]]></category>

		<guid isPermaLink="false">http://ericfickes.com/?p=1065</guid>
		<description><![CDATA[Wanted to share this since it gave me so much trouble figuring out.  It&#8217;s a simple SQL query ported to LINQ to SQL that joins two tables to return a filtered listed of data. Here are the tables from my schema Here is a basic SQL statement I could fire to retrieve my user videos. [...]]]></description>
			<content:encoded><![CDATA[<p>Wanted to share this since it gave me so much trouble figuring out.  It&#8217;s a simple SQL query ported to LINQ to SQL that joins two tables to return a filtered listed of data.</p>
<p>Here are the tables from my schema<br />
<a href="http://ericfickes.com/wp-content/uploads/2010/02/user-user_videos-video.png" rel="lightbox[1065]"><img class="aligncenter size-full wp-image-1068" title="My three user tables" src="http://ericfickes.com/wp-content/uploads/2010/02/user-user_videos-video.png" alt="user, user_video, video tables" width="465" height="317" /></a></p>
<p>Here is a basic SQL statement I could fire to retrieve my user videos.</p>
<pre class="brush: sql;">
select  *
from    video v, user_videos uv
where   v.vid = uv.vid
and     uv.uid = 2
</pre>
<p><a href="http://ericfickes.com/wp-content/uploads/2010/02/uservideos-SQL.png" rel="lightbox[1065]"><img class="aligncenter size-full wp-image-1069" title="Data returned from this SQL statement" src="http://ericfickes.com/wp-content/uploads/2010/02/uservideos-SQL.png" alt="User 2 has two videos" width="499" height="220" /></a><br />
Here is how you would run the same query using .net&#8217;s LINQ to SQL.</p>
<pre class="brush: csharp;">
// create DB connection
var db = new DBCONN();
// run query
List&lt;video&gt; uvids = (
    from c in db.video
    join o in db.user_videos
    on c.vid equals o.vid
    where o.uid == 2
    select c
).ToList();
</pre>
<p>This query differs slightly from the screenshot below because I used it in a WCF Service.</p>
<p><a href="http://ericfickes.com/wp-content/uploads/2010/02/uservideos-LINQTOSQL.png" rel="lightbox[1065]"><img class="aligncenter size-full wp-image-1070" title="Same query run via LINQ to SQL" src="http://ericfickes.com/wp-content/uploads/2010/02/uservideos-LINQTOSQL.png" alt="Same data, different retrieval method" width="488" height="419" /></a></p>
<p>The variable DBCONN is my database connection that I established when mapping my DB.  If you are not familiar with how to set this up, use the Visual Studio&#8217;s &#8220;Add the ADO.NET Entity Data Model&#8221; wizard.  With your .net project open, right click your project, left click on &#8220;Add the ADO.NET Entity Data Model&#8221;.  This wizard will walk you through setting up everything you need to setup your DB model file ( edmx ), as well as setting up your database connection and saving it in web.config.</p>
<p>Jesse Liberty did a <a title="ADO.NET DataEntities and WCF Feeding a Silverlight DataGrid" href="http://silverlight.net/learn/tutorials/adonetdataentities-cs/" target="_blank">simple tutorial that uses this wizard in a WCF service application</a>.</p>
<p>I hope this helps somebody out.</p>
]]></content:encoded>
			<wfw:commentRss>http://ericfickes.com/2010/02/how-to-join-two-tables-using-linq-to-sql/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Invalid token &#8216;void&#8217; in class, struct, or interface member declaration</title>
		<link>http://ericfickes.com/2010/02/invalid-token-void-in-class-struct-or-interface-member-declaration/</link>
		<comments>http://ericfickes.com/2010/02/invalid-token-void-in-class-struct-or-interface-member-declaration/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 23:32:34 +0000</pubDate>
		<dc:creator>Eric Fickes</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[tips and tricks]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[ADO.NET]]></category>
		<category><![CDATA[ADO.NET Entity Data Model]]></category>
		<category><![CDATA[edmx]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[visual studio 2008]]></category>
		<category><![CDATA[void]]></category>

		<guid isPermaLink="false">http://ericfickes.com/?p=1041</guid>
		<description><![CDATA[EDIT : After finishing this post I ran into all sorts of other strange issues and restarted using a Web Appliction instead of a plain old Website.  Between IntelliSense not showing any classes, to project reference issues, I couldn&#8217;t figured it out in time.  I&#8217;m sure there&#8217;s a way, I just had to move on.  So [...]]]></description>
			<content:encoded><![CDATA[<h2>EDIT :</h2>
<p>After finishing this post I ran into all sorts of other strange issues and restarted using a Web Appliction instead of a plain old Website.  Between <a title="IntelliSense is the BEST feature of all Visual Studios" href="http://en.wikipedia.org/wiki/IntelliSense" target="_blank">IntelliSense</a> not showing any classes, to project reference issues, I couldn&#8217;t figured it out in time.  I&#8217;m sure there&#8217;s a way, I just had to move on.  So maybe this ramble below will be helpful for someone.</p>
<address>EF</address>
<p>Just ran into something quirky with Visual Studio 2008&#8242;s new ADO.NET Entity Data Model wizard.  While working on an ASP.NET 3.5 website ( not a codebehind web application ) I was trying to get the ADO.NET Entity Data model wizard to work with MySQL and ran into a probable Visual Studio bug.  To sum up the issue, if you are going to add a new edmx to your project, do NOT save it to the App_Code folder initially.  Put it in your root folder, compile your project, then move the edmx where you&#8217;d like.</p>
<p>Assuming you&#8217;ve already created your ASP.NET Website project, here&#8217;s how you reproduce this issue.</p>
<h3 style="text-align: center;"><strong>Right click your project and left click &#8216;Add New Item&#8217;</strong></h3>
<p style="text-align: center;">
<div id="attachment_1042" class="wp-caption aligncenter" style="width: 390px"><a href="http://ericfickes.com/wp-content/uploads/2010/02/vs1-AddNewItem.png" rel="lightbox[1041]"><img class="size-full wp-image-1042" title="Add New Item" src="http://ericfickes.com/wp-content/uploads/2010/02/vs1-AddNewItem.png" alt="Right click your project, left click Add New Item" width="380" height="225" /></a><p class="wp-caption-text">Add New Item</p></div>
<h3 style="text-align: center;"><strong>Select ADO.NET Entity Data Model, name it, select your language of preference</strong></h3>
<p style="text-align: center;">
<div id="attachment_1045" class="wp-caption aligncenter" style="width: 372px"><a href="http://ericfickes.com/wp-content/uploads/2010/02/vs2-NewEDM1.png" rel="lightbox[1041]"><img class="size-full wp-image-1045" title="New ADO.NET Entity Data Model" src="http://ericfickes.com/wp-content/uploads/2010/02/vs2-NewEDM1.png" alt="New ADO.NET Entity Data Model" width="362" height="466" /></a><p class="wp-caption-text">ADO.NET Entity Data Model</p></div>
<h3 style="text-align: center;"><strong>Click Yes to the &#8216;Store in App_Code&#8217; prompt</strong></h3>
<p style="text-align: center;"><strong> </strong></p>
<div id="attachment_1046" class="wp-caption aligncenter" style="width: 500px"><strong><strong><a href="http://ericfickes.com/wp-content/uploads/2010/02/vs3-AddToAPP_CODE.png" rel="lightbox[1041]"><img class="size-full wp-image-1046" title="Place your edmx in App_Code folder" src="http://ericfickes.com/wp-content/uploads/2010/02/vs3-AddToAPP_CODE.png" alt="Place your edmx in App_Code folder" width="490" height="199" /></a></strong></strong><p class="wp-caption-text">Place file in &#39;App_Code&#39; folder</p></div>
<p><strong> </strong></p>
<h3 style="text-align: center;"><strong>Complete the new Entity Data Model wizard</strong></h3>
<p style="text-align: center;"><a title="ADO.NET DataEntities and WCF Feeding a Silverlight DataGrid" href="http://silverlight.net/learn/tutorials/adonetdataentities-cs/" target="_blank">See this tutorial if you have not done this before</a></p>
<p style="text-align: center;">
<p style="text-align: center;">
<h3 style="text-align: center;"><strong>Compile project after completing wizard</strong></h3>
<p style="text-align: left;">
<div id="attachment_1047" class="wp-caption aligncenter" style="width: 665px"><a href="http://ericfickes.com/wp-content/uploads/2010/02/vs4-BuildFail.png" rel="lightbox[1041]"><img class="size-full wp-image-1047" title="Invalid token 'void' in class, struct, or interface member declaration" src="http://ericfickes.com/wp-content/uploads/2010/02/vs4-BuildFail.png" alt="Invalid token 'void' in class, struct, or interface member declaration" width="655" height="399" /></a><p class="wp-caption-text">Invalid token &#39;void&#39; in class, struct, or interface member declaration</p></div>
<p style="text-align: left;">At this point your project should have a new.edmx file located inside of the App_Code folder, but the project won&#8217;t build without failing.  If you are stuck in this predicament, follow this workaround.</p>
<h3 style="text-align: center;"><strong>Move .edmx to root folder and rebuild</strong></h3>
<p style="text-align: left;"><strong> </strong></p>
<div id="attachment_1048" class="wp-caption aligncenter" style="width: 346px"><strong><strong><a href="http://ericfickes.com/wp-content/uploads/2010/02/vs5-move_edmx.png" rel="lightbox[1041]"><img class="size-full wp-image-1048" title="Move edmx to root and recompile, no errors!" src="http://ericfickes.com/wp-content/uploads/2010/02/vs5-move_edmx.png" alt="Move edmx to root and recompile, no errors!" width="336" height="468" /></a></strong></strong><p class="wp-caption-text">WORKAROUND : move edmx to root folder, then recompile</p></div>
<p><strong> </strong></p>
<p style="text-align: left;">
<p style="text-align: left;">After moving your edmx file to the root folder you should be able to compile without problem.  Assuming this solves your problem, you should be able to move your edmx file to the App_Code folder without problem.  Seems like an initial compile problem<strong>.<br />
</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://ericfickes.com/2010/02/invalid-token-void-in-class-struct-or-interface-member-declaration/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
