User does not have permission to perform this action. in an image table creation
<p>Trying to create an image table I use the following code</p>

<pre><code>CMScomClass.SQLComm = New SqlCommand("EXEC sp_configure 'filestream_access_level', '2' ", CMScomClass.globalPar.SQLConn)
Thread.Sleep(CMScomClass.globalParms.sleepTime)

If CMScomClass.globalPar.SQLConn.State = ConnectionState.Closed Then
    CMScomClass.globalPar.SQLConn.Open()
    CMScomClass.SQLComm.ExecuteNonQuery()
Else
    CMScomClass.SQLComm.ExecuteNonQuery()
End If

CMScomClass.SQLComm = New SqlCommand("RECONFIGURE", CMScomClass.globalPar.SQLConn)
Thread.Sleep(CMScomClass.globalParms.sleepTime)

If CMScomClass.globalPar.SQLConn.State = ConnectionState.Closed Then
     CMScomClass.globalPar.SQLConn.Open()
     CMScomClass.SQLComm.ExecuteNonQuery()
Else
     CMScomClass.SQLComm.ExecuteNonQuery()
End If

CMScomClass.SQLComm = New SqlCommand("CREATE TABLE dbo." &amp; tName &amp; " (" &amp;
             FieldName &amp; " UNIQUEIDENTIFIER ROWGUIDCOL NOT NULL UNIQUE , " &amp;
             "Image varbinary(MAX) FILESTREAM NOT NULL ) ", CMScomClass.globalPar.SQLConn)
Thread.Sleep(CMScomClass.globalParms.sleepTime)

If CMScomClass.globalPar.SQLConn.State = ConnectionState.Closed Then
    CMScomClass.globalPar.SQLConn.Open()
    CMScomClass.SQLComm.ExecuteNonQuery()
Else
    CMScomClass.SQLComm.ExecuteNonQuery()
End If

CMScomClass.MainWin.OpenCloseImage(sender, e)
</code></pre>

<p>When my code is before the process of </p>

<pre><code>CMScomClass.SQLComm.ExecuteNonQuery()
</code></pre>

<p>I have the following connection string</p>

<pre><code>Data Source=(local)\SQLEXPRESS;Initial Catalog=MSSQLLocalDB;User ID=CMSadmin;Password=pm@ce#7b$
</code></pre>

<p>On which we see the user name</p>

<pre><code>Uid = CMSadmin password= pm@ce#7b$
</code></pre>

<p>The user is also 'LoginUser' and database user and has credential to 'sa' account of my server.</p>

<p>The problem is when I’m trying to execute </p>

<pre><code>CMScomClass.SQLComm.ExecuteNonQuery()
</code></pre>

<p>it throws the error </p>

<blockquote>
  <p>User does not have permission to perform this action. And also I'm loosing the Password of my account.</p>
</blockquote>

<p>The same code was working fine in previous programs now I don’t know why I get this error</p>