<?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>Software Rockstar &#187; SQL Server</title>
	<atom:link href="http://www.softwarerockstar.com/tag/sql-server/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.softwarerockstar.com</link>
	<description>Coaching and mentoring on a journey from a Developer to an IT Leader</description>
	<lastBuildDate>Tue, 13 Sep 2011 17:18:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>POCO in ADO.NET Entity Framework 4</title>
		<link>http://www.softwarerockstar.com/2011/01/poco-in-ado-net-entity-framework-4/</link>
		<comments>http://www.softwarerockstar.com/2011/01/poco-in-ado-net-entity-framework-4/#comments</comments>
		<pubDate>Tue, 18 Jan 2011 22:45:42 +0000</pubDate>
		<dc:creator>SoftwareRockstar</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[ADO.NET]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Change]]></category>
		<category><![CDATA[data access technologies]]></category>
		<category><![CDATA[Entity Framework]]></category>
		<category><![CDATA[entity models]]></category>
		<category><![CDATA[LINQ]]></category>
		<category><![CDATA[loading]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[model]]></category>
		<category><![CDATA[object relational mapping]]></category>
		<category><![CDATA[OOA/OOD]]></category>
		<category><![CDATA[OR/M]]></category>
		<category><![CDATA[oriented domain]]></category>
		<category><![CDATA[POCO]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[trivial data]]></category>

		<guid isPermaLink="false">http://www.softwarerockstar.com/?p=625</guid>
		<description><![CDATA[ADO.NET Entity Framework means many things to many people.  At it’s core, however, it allows for Object Relational Mapping (ORM) by providing a layer of abstraction between relational databases and Object Oriented domain objects. The first version of Entity Framework was introduced with .NET Framework 3.5 SP1 and Visual Studio 2008 SP1.  While the intention [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://msdn.microsoft.com/en-us/library/aa697427(v=vs.80).aspx">ADO.NET Entity Framework</a> means many things to many people.  At it’s core, however, it allows for Object Relational Mapping (ORM) by providing a layer of abstraction between relational databases and Object Oriented domain objects.</p>
<p>The first version of Entity Framework was introduced with .NET Framework 3.5 SP1 and Visual Studio 2008 SP1.  While the intention was great, most of everyone that I know, including my own self who have ever tried using EFv1 for anything except trivial data access have developed a love-and-hate relationship with it.  The first version looked great at first, but turned out to be an immature product at best with severe restrictions as well as quite a few bugs.</p>
<p>With .NET 4 Microsoft released a new version of Entity Framework that has addressed many of the issues and made it a much more stable technology.  Amongst other things, Microsoft heard developer community at large and provided POCO support in EFv4.</p>
<p><strong>POCO Support &#8211; At Last!</strong></p>
<p>The biggest problem with EFv1 was that the domain classes had to be tightly integrated with EF.  Essentially these classes were generated from entity models and developers had no control over code generation.  This limitation didn’t fly very well with most developers, since we like to keep our domain classes generic enough to where we can easily migrate them to any underlying data access technology.  This is especially true since the data access technologies tend to change every so often.</p>
<p>In EFv4 Microsoft has gone to great lengths to support Plain Old CLR Objects (POCO), which is just a fancy name for simple .NET classes with properties that can be used as Data Transfer Objects (DTO) or simply Domain Objects.</p>
<p><a href="http://en.wikipedia.org/wiki/Plain_Old_CLR_Object">POCO</a> classes can be handwritten and easily hooked in to EFv4.  Better yet, EFv4 allows us to generate these classes based on our entity models.  Also we have complete control over code generation since EFv4 uses <a href="http://msdn.microsoft.com/en-us/library/bb126445.aspx">T4 templates</a>.  Speaking of <a href="http://msdn.microsoft.com/en-us/library/bb126445.aspx">T4 templates</a>, they can also be used to generate <a href="http://msdn.microsoft.com/en-us/library/system.data.objects.objectcontext.aspx">ObjectContext</a> classes for our entity models.</p>
<p><strong>Lazy Loading, Explicit Loading, and Eager Loading</strong></p>
<p>In EFv1 the only way to automatically load related entities was using eager loading.  Essentially eager loading is a <a href="http://www.google.com/url?sa=t&amp;source=web&amp;cd=1&amp;ved=0CCgQFjAA&amp;url=http%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Fnetframework%2Faa904594&amp;ei=JcY0Tb32HsqWhQfy69S9Cw&amp;usg=AFQjCNFXPCT1aJ1K461wVDeLDLlRwCB7Vw&amp;sig2=yZcOmHzhHUottOaC-SApQA">LINQ</a> technique that allows loading related entities in one shot using the Include method on the LINQ query.</p>
<p>EFv4 allows for lazy loading on POCO’s.  The only requirement for this added functionality is that navigation properties on POCO’s be marked as virtual and <a href="http://msdn.microsoft.com/en-us/library/system.data.objects.objectcontextoptions.lazyloadingenabled.aspx">LazyLoadingEnabled</a> property of <a href="http://msdn.microsoft.com/en-us/library/system.data.objects.objectcontextoptions.aspx">ObjectContextOptions</a> be set to true.  The way EFv4 does this is very cool.  Essentially it generates dynamic proxies overriding the virtual properties on POCO’s and uses those proxies instead of the POCO classes at runtime.</p>
<p>In addition to eager and lazy loading, EFv4 allows explicit loading of related entities.  Explicit loading allows us to explicitly load related entities on demand whenever the need arises.  Using explicit loading is as easy as calling the <a href="http://msdn.microsoft.com/en-us/library/dd382880.aspx">LoadProperty</a> method of the <a href="http://msdn.microsoft.com/en-us/library/system.data.objects.objectcontext.aspx">ObjectContext</a> using  the parent entity as well as the navigation property name as parameters.</p>
<p><strong>Change Tracking</strong></p>
<p>EFv4 supports two different types of change tracking which are as follows:</p>
<p><strong>Snapshot Change Tracking</strong>.  Using this kind of change tracking is more efficient in most cases but it might require a few additional lines of code.  When using snapshot change tracking (default behavior in EFv4), the developer must make explicit call to <a href="http://msdn.microsoft.com/en-us/library/system.data.objects.objectcontext.aspx">ObjectContext</a>’s <a href="http://msdn.microsoft.com/en-us/library/system.data.objects.objectcontext.detectchanges.aspx">DetectChanges</a> method in order for the EF change tracker to notice any data that has been changed on the entity since it was first retrieved.  Also calling the <a href="http://www.google.com/url?sa=t&amp;source=web&amp;cd=1&amp;sqi=2&amp;ved=0CBMQFjAA&amp;url=http%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Fbb336792.aspx&amp;ei=Kcc0TcoZg8yEB7fe0M8L&amp;usg=AFQjCNE7rfcpXzJatP4e27jk4gjOGewMGg&amp;sig2=xpf8b9OofvMUSm3GB8arTQ">SaveChanges</a> method of the context automatically detects any changes to entities involved.</p>
<p><strong>Real-time Change Tracking</strong>.  Using real-time change tracking the tracker keeps track of all data changes to entities in real-time.  For real-time change tracking to work for POCO’s, all properties of POCO’s should be marked as virtual.  Also any navigation properties should have return types of <a href="http://www.google.com/url?sa=t&amp;source=web&amp;cd=1&amp;ved=0CBYQFjAA&amp;url=http%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2F92t2ye13.aspx&amp;ei=vcc0TeGPL4uwhQfRl728Cw&amp;usg=AFQjCNH9Rx-AertMm5Z70BoXDKVKjEf7zg&amp;sig2=qZlGJ7KMoxVlnZnGtwxeLw">ICollection&lt;T&gt;</a>.  Once these two conditions are met, EFv4 automatically generates dynamic proxies and uses them instead of the POCO’s and tracks changes made to data contained within those entities in real time.</p>
<p><strong>Design Techniques</strong></p>
<p>EFv4 allows a couple of different design techniques that ought to satisfy most situations.</p>
<p><strong>Model First</strong>.  For new projects where that database design is not already set in stone or is non-existent, model-first approach is more natural to most developers and makes a lot of sense.  What this entails is that the developer creates an entity model using the <a href="http://www.google.com/url?sa=t&amp;source=web&amp;cd=1&amp;ved=0CBoQFjAA&amp;url=http%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Fcc716685.aspx&amp;ei=K8g0TYjSF4GGhQebm-CYCw&amp;usg=AFQjCNEisyxXXpKQ55JXj6LiDlN9upsjXg&amp;sig2=jiah8MV9pRlpkhyEbdcjLA">Entity Model Designer</a> for the domain objects involved.  This model can be easily changed during the design phase or the early development stages.  Once the architect/developer is happy with the entity design, he/she can use EFv4 to generate the data model using EFv4’s Data Definition Language (DDL) generation capabilities.  Not only that this is a more natural way of designing data access and domain model for a given solution, it’s more agile in that the model can easily be modified using a GUI tool.  Also as long as the underlying database is supported by EFv4, the developer need not worry about the exact syntax of the DDL as it can automatically be generated.  Once again the generation of DDL can be influenced using <a href="http://msdn.microsoft.com/en-us/library/bb126445.aspx">T4 templates</a>.</p>
<p><strong>Database First</strong>.  This technique is more suitable for when a project involves an existing database.  In such cases EF can easily generate domain models based on database schema.  This design technique is not new to EFv4 as it has been available since the first version of EF and this is probably what most of us are most familiar with.</p>
<p><strong>Code Only</strong>.  EFv4 introduced another design technique which requires no models to be created.  Essentially there are only code classes and EF infers the model from them.  Entire database including all required tables can be generated by EF at run-time.</p>
<p>There’s a lot more to EFv4.  What I have covered in this article only addresses a bit of POCO support in EFv4 since that has been the number 1 request of the development community since EFv1 was released.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.softwarerockstar.com/2011/01/poco-in-ado-net-entity-framework-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Astoria and Jasper: Old Ideas New Technology</title>
		<link>http://www.softwarerockstar.com/2007/10/astoria-and-jasper-old-ideas-new-technology/</link>
		<comments>http://www.softwarerockstar.com/2007/10/astoria-and-jasper-old-ideas-new-technology/#comments</comments>
		<pubDate>Fri, 19 Oct 2007 01:19:00 +0000</pubDate>
		<dc:creator>SoftwareRockstar</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Other]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[ADO.NET]]></category>
		<category><![CDATA[Agile]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Cool Tools]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://mharoon.wordpress.com/2007/10/18/astoria-and-jasper-old-ideas-new-technology/</guid>
		<description><![CDATA[SubSonic is an excellent open source DAL generation tool developed by Rob Conery that has been around for almost a year. In most cases SubSonic can just be added to your project, pointed to a databse, and you magically and immediately gain access to a rich and strongly typed object model that can be used [...]]]></description>
			<content:encoded><![CDATA[<div class="imageleft"><img src="http://softwarerockstar.com/wp-content/uploads/2007/10/dotnet.png" alt="Microsoft .NET" title="Microsoft .NET" width="189" height="100" /></div>
<p><a href="http://www.subsonicproject.com/">SubSonic</a> is an excellent open source <a href="http://en.wikipedia.org/wiki/Data_access_layer">DAL</a> generation tool developed by Rob Conery that has been around for almost a year. In most cases <a href="http://www.subsonicproject.com/">SubSonic</a> can just be added to your project, pointed to a databse, and you magically and immediately gain access to a rich and strongly typed object model that can be used to query and persist data to and from your relational data source.</p>
<p><a href="http://www.subsonicproject.com/">SubSonic</a> also has a cool feature called the <a href="http://en.wikipedia.org/wiki/REST">REST</a> handler that essentially allows one to use <a href="http://en.wikipedia.org/wiki/Http">HTTP</a> protocol as an interface to data stored in a back-end relational database. It is <a href="http://en.wikipedia.org/wiki/Uniform_Resource_Identifier">URI</a> based and returns data back in <a href="http://en.wikipedia.org/wiki/Xml">XML</a> format. This data can then be used by decoupled client applications as they see fit. If you have never looked at <a href="http://www.subsonicproject.com/">SubSonic</a>, you owe it to yourself to checkout this very cool tool.</p>
<p>Recently Microsoft unveiled their plans to release similar features codenamed <a href="http://astoria.mslivelabs.com/">Astoria</a> and <a href="http://msdn2.microsoft.com/en-us/data/bb419139.aspx">Jasper</a> with <a href="http://msdn2.microsoft.com/en-us/vstudio/aa700831.aspx">.NET framework 3.5 and Visual Studio 2008</a>. The CTP of <a href="http://astoria.mslivelabs.com/">Astoria</a> and <a href="http://msdn2.microsoft.com/en-us/data/bb419139.aspx">Jasper</a> are available for download from Microsoft.</p>
<p>Jasper is described by Microsoft as:</p>
<blockquote><p>Project Jasper is geared towards iterative and agile development. You can<br />
start interacting with the data in your database without having to create<br />
mapping files or define classes. You can build user interfaces by naming<br />
controls according to your model without worrying about binding code. Project<br />
Jasper is also extensible, allowing you to provide your own business logic and<br />
class model. Since Project Jasper is built on top of the ADO.NET Entity<br />
Framework, it supports rich queries and complex mapping.
</p></blockquote>
<p>Pablo Castro, the mastermind behind Astoria describes it as:</p>
<blockquote><p>The goal of Microsoft Codename Astoria is to enable applications to expose data as a data service that can be consumed by web clients within a corporate network and across the internet. The data service is reachable over HTTP, and URIs are used to identify the various pieces of information available through the service. Interactions with the data service happens in terms of HTTP verbs such as GET, POST, PUT and DELETE, and the data exchanged in those interactions is represented in simple formats such as XML and JSON.</p></blockquote>
<p>The <a href="http://astoria.mslivelabs.com/">Astoria</a> web site also includes <a href="http://astoria.mslivelabs.com/OnlineService.aspx">sample online services</a> that showcases how this new technology can be used. It also allows anyone with a Passport account to design and host their own experimental data services .</p>
]]></content:encoded>
			<wfw:commentRss>http://www.softwarerockstar.com/2007/10/astoria-and-jasper-old-ideas-new-technology/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Server Database Comparison and Synchronization</title>
		<link>http://www.softwarerockstar.com/2007/04/sql-server-database-comparison-and-synchronization/</link>
		<comments>http://www.softwarerockstar.com/2007/04/sql-server-database-comparison-and-synchronization/#comments</comments>
		<pubDate>Wed, 18 Apr 2007 12:02:00 +0000</pubDate>
		<dc:creator>SoftwareRockstar</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[c source code]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[content comparison]]></category>
		<category><![CDATA[Cool Tools]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[database comparison]]></category>
		<category><![CDATA[database schema]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[Rants & Raves]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Synchronization]]></category>
		<category><![CDATA[task]]></category>
		<category><![CDATA[third party tools]]></category>

		<guid isPermaLink="false">http://mharoon.wordpress.com/2007/04/18/sql-server-database-comparison-and-synchronization/</guid>
		<description><![CDATA[Since database are usually designed in development environments, migrating changes&#160;over to other environments (e.g. QA and production) is not a trivial task.&#160; This is because SQL Server does not have any built-in tools to compare database schemas.&#160; There are quite a few third-party tools that would make your life easier, most notably, Red Gate&#8217;s SQL [...]]]></description>
			<content:encoded><![CDATA[<div class="imageleft"><img src="http://softwarerockstar.com/wp-content/uploads/2007/04/ms_sql_logo1.gif" alt="SQL Server" width="240" height="118" /></div>
<p>Since database are usually designed in development environments, migrating changes&nbsp;over to other environments (e.g. QA and production) is not a trivial task.&nbsp; This is because SQL Server does not have any built-in tools to compare database schemas.&nbsp; </p>
<p>There are quite a few third-party tools that would make your life easier, most notably, <a title="Red Gate's SQL Compare" href="http://www.red-gate.com/" target="_blank">Red Gate&#8217;s SQL Compare</a>&nbsp;(reasonably priced around $300).</p>
<p>At times, buying a commercial tool is not really an option, so one must resort to googling for free tools.&nbsp; There are three such tools that I am aware of:</p>
<ol>
<li><a title="SQLDBDiff by SQLDBTools" href="http://www.sqldbtools.com/Snapshots.aspx?ProductId=1"><strong>SQLDBDiff by SQLDBTools</strong></a><br />A very decent tool that comes in both freeware and shareware versions.&nbsp; Freeware version is not badly crippled; only advanced features such as multi-database comparison, data content comparison, etc. are disabled.</p>
</li>
<li><a title="Database Schema Comparison Utility" href="http://www.codeproject.com/useritems/DatabaseCompare.asp"><strong>Database Schema Comparison Utility</strong></a><br />This is a Code Project article that comes with C# source code&nbsp;of a schema comparison utility.&nbsp; The utility itself is pretty bare-bone, but gets the job done.
</li>
<li><a title="StarInix Free Database Compare 2.0" href="http://www.starinix.com/sqlcompare02.htm"><strong>StarInix Free Database Compare 2.0</strong></a><br />I have not used this tool, but from the advertised feature list, it looks pretty good.&nbsp; Most notably, in addition to SQL Server, this tool works with Access and MySQL databases.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.softwarerockstar.com/2007/04/sql-server-database-comparison-and-synchronization/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Server Locking Hints</title>
		<link>http://www.softwarerockstar.com/2007/02/sql-server-locking-hints/</link>
		<comments>http://www.softwarerockstar.com/2007/02/sql-server-locking-hints/#comments</comments>
		<pubDate>Tue, 06 Feb 2007 02:27:00 +0000</pubDate>
		<dc:creator>SoftwareRockstar</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://mharoon.wordpress.com/2007/02/05/sql-server-locking-hints/</guid>
		<description><![CDATA[While SQL Server provides automatic data locking mechanism which is good enough for most situations, there are times when developers must provide locking hints in their queries for better performance. There are several locking hints that can be used with SQL Server, however, the two most common ones are as follows: READ COMMITTED This is [...]]]></description>
			<content:encoded><![CDATA[<div class="imageleft"><img src="http://softwarerockstar.com/wp-content/uploads/2007/04/ms_sql_logo1.gif" alt="SQL Server" title="SQL Server" width="240" height="118" class="alignnone size-full wp-image-309" /></div>
<p>While SQL Server provides automatic data locking mechanism which is good enough for most situations, there are times when developers must provide locking hints in their queries for better performance. There are <a href="http://msdn2.microsoft.com/en-us/library/aa213026(SQL.80).aspx">several locking hints</a> that can be used with SQL Server, however, the two most common ones are as follows:</p>
<p><strong><span style="font-size:130%;">READ COMMITTED</span><br />
</strong>This is the default locking strategy used by SQL Server.</p>
<p><strong>PROS: </strong><br />
Guarantees that only committed data is read.</p>
<p><strong>CONS:</strong><br />
If a writer has a lock in place, readers are blocked until the writer releases it&#8217;s lock, hence delaying readers.</p>
<p><strong>EXAMPLE</strong></p>
<pre class="brush: sql">
-- Default behavior; no special hint required
SELECT EmployeeID, EmployeeName FROM Employee
</pre>
</p>
<p><strong><span style="font-size:130%;">NOLOCK or READ UNCOMMITTED</span><br />
</strong>It is best used when approximations are acceptable, or for &#8220;dual-role&#8221; systems where database is responsible for many simultaneous reads and writes.</p>
<p><strong>PROS:</strong><br />
Reads are blazing fast, since any exclusive locks are ignored.  Also Shared Locks are not issued on rows read, so writers do not have to wait for read operations to complete.</p>
<p><strong>CONS:</strong><br />
Data read may not be 100% accurate, since exclusive locks are ignored.</p>
<p><strong>EXAMPLE</strong></p>
<pre class="brush: sql">
-- NOLOCK hint is used
SELECT EmployeeID, EmployeeName WITH (NOLOCK) FROM Employee
</pre></p>
]]></content:encoded>
			<wfw:commentRss>http://www.softwarerockstar.com/2007/02/sql-server-locking-hints/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get Table Schema Programatically</title>
		<link>http://www.softwarerockstar.com/2006/08/get-table-schema-programatically/</link>
		<comments>http://www.softwarerockstar.com/2006/08/get-table-schema-programatically/#comments</comments>
		<pubDate>Fri, 18 Aug 2006 11:25:00 +0000</pubDate>
		<dc:creator>SoftwareRockstar</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[ADO.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[col]]></category>
		<category><![CDATA[CommandBehavior]]></category>
		<category><![CDATA[datareader]]></category>
		<category><![CDATA[datatable]]></category>
		<category><![CDATA[foreach]]></category>
		<category><![CDATA[initial catalog]]></category>
		<category><![CDATA[integrated security]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[OleDbCommand]]></category>
		<category><![CDATA[Schema]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[table schema]]></category>

		<guid isPermaLink="false">http://mharoon.wordpress.com/2006/08/18/get-table-schema-programatically/</guid>
		<description><![CDATA[In order to retreive table schema programatically, we can use the GetSchemaTable method of the DataReader as follows: using (OleDbConnection cn = new OleDbConnection()) { OleDbCommand cmd; DataTable schemaTable; OleDbDataReader reader; cn.ConnectionString = @&#34;Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Northwind;Data Source=(local);&#34;; cn.Open(); cmd = new OleDbCommand(&#34;Employees&#34;, cn); cmd.CommandType = CommandType.TableDirect; using (reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly &#124; CommandBehavior.KeyInfo)) { [...]]]></description>
			<content:encoded><![CDATA[<p>In order to retreive table schema programatically, we can use the <a href="http://support.microsoft.com/kb/310107/EN-US/">GetSchemaTable</a> method of the DataReader as follows:</p>
<pre class="brush: csharp">
using (OleDbConnection cn = new OleDbConnection())
{
    OleDbCommand cmd;
    DataTable schemaTable;
    OleDbDataReader reader;

    cn.ConnectionString = @&quot;Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Northwind;Data Source=(local);&quot;;
    cn.Open();

    cmd = new OleDbCommand(&quot;Employees&quot;, cn);
    cmd.CommandType = CommandType.TableDirect;

    using (reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly | CommandBehavior.KeyInfo))
    {
        schemaTable = reader.GetSchemaTable();

        foreach (DataRow row in schemaTable.Rows)
        {
            foreach (DataColumn col in schemaTable.Columns)
                Console.WriteLine(col.ColumnName + &quot; = &quot; + row[col].ToString());

            Console.WriteLine();
        }

        reader.Close();
    }

    cn.Close();
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.softwarerockstar.com/2006/08/get-table-schema-programatically/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Client Side Reports in Visual Studio 2005</title>
		<link>http://www.softwarerockstar.com/2006/08/client-side-reports-in-visual-studio-2005/</link>
		<comments>http://www.softwarerockstar.com/2006/08/client-side-reports-in-visual-studio-2005/#comments</comments>
		<pubDate>Thu, 17 Aug 2006 14:13:00 +0000</pubDate>
		<dc:creator>SoftwareRockstar</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[CSV]]></category>
		<category><![CDATA[excel csv]]></category>
		<category><![CDATA[export pdf]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[nifty features]]></category>
		<category><![CDATA[Reporting]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Reporting Services]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Studio]]></category>
		<category><![CDATA[style reports]]></category>
		<category><![CDATA[Viewer]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[visual studio 2005]]></category>
		<category><![CDATA[WinForms]]></category>

		<guid isPermaLink="false">http://mharoon.wordpress.com/2006/08/17/client-side-reports-in-visual-studio-2005/</guid>
		<description><![CDATA[Perhaps the best kept secret (or at least the least discussed feature) of Visual Studio 2005 is the client-side reports. Client-side reports consists of the Report Viewer Control and it&#8217;s accompanying Report Designer that comes standard with Visual Studio 2005 Professional and up. This feature can be used to develop ASP.NET or WinForms solutions that [...]]]></description>
			<content:encoded><![CDATA[<p>Perhaps the best kept secret (or at least the least discussed feature) of Visual Studio 2005 is the client-side reports. Client-side reports consists of the <a href="http://msdn2.microsoft.com/en-us/library/ms251671.aspx">Report Viewer Control</a> and it&#8217;s accompanying Report Designer that comes standard with Visual Studio 2005 Professional and up.</p>
<p>This feature can be used to develop ASP.NET or <span class="blsp-spelling-error">WinForms</span> solutions that sport <a href="http://microsoft.com/sql/reporting/"><span class="blsp-spelling-error">SQL</span> Server Reporting Services</a> style reports, without having to deploy those reports to a Reporting Server. Reports are deployed as <span class="blsp-spelling-error">RDLC</span> files with your solutions. In fact one doesn&#8217;t even need <span class="blsp-spelling-error">SQL</span> Server, since these reports can be <span class="blsp-spelling-error">programatically</span> bound to objects such as <span class="blsp-spelling-error">DataSets</span>, a huge plus for <span class="blsp-spelling-error">ditributed</span> n-tier designs where the <span class="blsp-spelling-error">UI</span> layer does not have direct access to the data store. This also means that one can use any imaginable back-end data store including XML and <span class="blsp-spelling-error">CSV</span> files as long as data can be loaded into <span class="blsp-spelling-error">binable</span> objects.</p>
<p>The report viewer control is similar to Reporting Services report viewer, with nifty features such as paging, searching, and export (<span class="blsp-spelling-error">PDF</span>, Excel, <span class="blsp-spelling-error">CSV</span>) features. My only complain with the ASP.NET version of the report viewer is that it does not directly support printing. Reports have to be exported to <span class="blsp-spelling-error">PDF</span> in order for one to print. This was a gotcha with the first versions of Reporting Services report viewer as well, but later they added printing support to the control (perhaps through <span class="blsp-spelling-error">ActiveX</span>) in Reporting Services SP1.</p>
<p>You can find more information about this feature at <a href="http://www.gotreportviewer.com/"><span class="blsp-spelling-error">GotReportViewer</span></a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.softwarerockstar.com/2006/08/client-side-reports-in-visual-studio-2005/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Securing ASP.NET 2.0 Apps Using Membership and Role Providers</title>
		<link>http://www.softwarerockstar.com/2006/08/securing-asp-net-2-0-apps-using-membership-and-role-providers/</link>
		<comments>http://www.softwarerockstar.com/2006/08/securing-asp-net-2-0-apps-using-membership-and-role-providers/#comments</comments>
		<pubDate>Thu, 17 Aug 2006 11:55:00 +0000</pubDate>
		<dc:creator>SoftwareRockstar</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://mharoon.wordpress.com/2006/08/17/securing-asp-net-2-0-apps-using-membership-and-role-providers/</guid>
		<description><![CDATA[I recently designed an intranet application using ASP.NET 2.0 and really loved the membership and role providers that tremendously simplifified our implementation of security features in the application. Membership and role information can be stored in a SQL Server database or another repository such as Active Directory. For our intranet application it made sense to [...]]]></description>
			<content:encoded><![CDATA[<p>I recently designed an intranet application using ASP.NET 2.0 and really loved the membership and role providers that tremendously simplifified our implementation of security features in the application. Membership and role information can be stored in a SQL Server database or another repository such as Active Directory. For our intranet application it made sense to use Active Directory as the membership provider and SQL Server as the role provider.</p>
<p><strong>Configuring Role and Membership Providers:</strong></p>
<p>Essentially everything is configured declaritively using Web.config:</p>
<p>
In the above configuration file, note that we first specify our connection strings starting at line 2. LocalSqlServer points to a SQL Server database which has been configured using <a href="http://msdn2.microsoft.com/en-us/library/x28wfk74.aspx">aspnet_regsql</a>. The second connection string points to the domain controller for membership authentication.</p>
<p>In the authentication section we specify that we are using forms authentication, and provide the URL for our logon page.</p>
<p>In the roleManager section we configure our role provider, pointing back to LocalSqlServer as the role repository.</p>
<p>In the membership section we configure our membership provider pointing back to ADConnectionString (domain controller) specified in the connectionStrings section.</p>
<p>Finally we restrict users from accessing certain folders based on their roles using location sections (role-based security).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.softwarerockstar.com/2006/08/securing-asp-net-2-0-apps-using-membership-and-role-providers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Copy Virtual Machine With SQL Server Installed</title>
		<link>http://www.softwarerockstar.com/2006/08/copy-virtual-machine-with-sql-server-installed/</link>
		<comments>http://www.softwarerockstar.com/2006/08/copy-virtual-machine-with-sql-server-installed/#comments</comments>
		<pubDate>Wed, 16 Aug 2006 11:30:00 +0000</pubDate>
		<dc:creator>SoftwareRockstar</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[Hyper-V]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Virtual PC]]></category>
		<category><![CDATA[Virtual Server]]></category>

		<guid isPermaLink="false">http://mharoon.wordpress.com/2006/08/16/copy-virtual-machine-with-sql-server-installed/</guid>
		<description><![CDATA[I copied the VHD file of a virtual machine that had SQL Server 2000 installed on it. After running NEWSID from Sysinternals and giving my virtual machine a new name, I had to deal with the fact that SQL Server would not recognize my new machine name. Luckily I found this FAQ on Vyas’s web [...]]]></description>
			<content:encoded><![CDATA[<p>I copied the VHD file of a virtual machine that had SQL Server 2000 installed on it. After running <a href="http://www.sysinternals.com/Utilities/NewSid.html">NEWSID </a>from <a href="http://www.sysinternals.com/">Sysinternals</a> and giving my virtual machine a new name, I had to deal with the fact that SQL Server would not recognize my new machine name. Luckily I found this <a href="http://vyaskn.tripod.com/administration_faq.htm#q5">FAQ</a> on Vyas’s web site that solved my problem. Essentially I had to drop and add my SQL Server as follows in order for things to start working correctly:</p>
<pre class="brush: sql">
EXEC sp_dropserver &#039;Your_OLD_Computer_Name&#039;
GO

EXEC sp_addserver &#039;Your_NEW_Computer_Name&#039;, &#039;local&#039;
GO
</pre>
<p>Restart your SQL Server service. Connect using Query Analyzer and run the following command (It should output the new server name):</p>
<pre class="brush: sql">
SELECT @@SERVERNAME
GO
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.softwarerockstar.com/2006/08/copy-virtual-machine-with-sql-server-installed/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

