title: How can I set read-only DB Connection Strings?
body: <p>I've got a DB connection string that I'm creating in my web.config:</p>
  <pre><code>&lt;connectionStrings&gt;   
  &lt;add name=&quot;DBConn&quot; connectionString=&quot;Data Source=&lt;db svr&gt;;Initial Catalog=&lt;dbname&gt;;Integrated Security=True&quot; providerName=&quot;System.Data.SqlClient /&gt;   
  &lt;/connectionStrings&gt;
  </code></pre>
  <p>or</p>
  <pre><code>Data Source=&lt;db svr&gt;;Database=&lt;db name&gt;;User ID=&lt;uname&gt;;Password=&lt;pword&gt;;
  </code></pre>
  <p>but I need this connection to be read only. I've defined all my linq objects with only gets on their properties, and none of my (MVC) repository classes have <code>.SubmitChanges()</code> methods in them so I'm 99% sure the system can't update this DB, but I would also like to set my DB connection to be RO if at all possible.  I realise that ideally this should be done at the SQL server end and the user should be made RO, but that (for various reasons, out of my control) can't be done, so I wanted to lock down my connection as the app mustn't write to the DB.</p>
  <p>Is there a &quot;readonly&quot; parameter I can apply to the connection string so that it would throw an error or discard the data if any updates were attempted?</p>
  <p>Just to reiterate (the 1st answer I had, when asking this, on another forum was &quot;change your DB credentials&quot;) I cannot, in any way, change the DB access credentials, these are read-write, and any attempt to change them (currently) crashes the SQL Server database.</p>
  <p>This is not my problem, and I can't look at resolving that issue, so that's why I want to look at making the DB connection read-only as it absolutely, positively can't change the DB data.</p>