<p>I was reviewing some code that a consultant checked in and notice they were using SQLCLR.  I don't have any experience with it so thought I would research what it was about.  I noticed that they used</p>

<pre><code>Dim cn As New SqlConnection("server=LOCALHOST;integrated security=yes;database=" &amp; sDb)
</code></pre>

<p>instead of</p>

<pre><code>DIM conn As New SqlConnection("context connection=true")
</code></pre>

<p>I'm wondering what the difference since it's localhost on the first?</p>

The context connection uses the user's already established connection to the server.  So you inherit things like their database context, connection options, etc.
Using localhost will connect to the server using a normal shared memory connection.  This can be useful if you don't want to use the user's connection (i.e. if you want to connect to a different database, or with different options, etc).
In most cases you should use the context connection, since it doesn't create a separate connection to the server.
Also, be warned that using a separate connection means you are not part of the user's transaction and are subject to normal locking semantics.