title: SQL Reporting Services Trying to use embed code to access database
body: <p>I’m trying to open a data base on embed vb code.  On the <code>MyConnection.Open()</code> I get a error saying </p>
  
  <blockquote>
    <p>Warning   1   [rsRuntimeErrorInExpression] The Value expression for the
    textrun ‘Textbox1.Paragraphs[0].TextRuns[0]’ contains an error:
    Request for the permission of type
    'System.Data.SqlClient.SqlClientPermission, System.Data,
    Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
    failed.   C:\Users\tedpottel\Documents\Visual Studio</p>
  </blockquote>
  
  <p>My datasource in the report is <code>Data Source=(local);Initial Catalog=bw</code><br>
  vb code is:</p>
  
  <pre><code>Public Function TestData  () As Boolean
  Dim MyConnection As System.Data.SQLClient.SqlConnection
  Dim MyCommand As System.Data.SQLClient.SqlCommand
  MyConnection = New System.Data.SQLClient.SqlConnection("server=(local);Initial Catalog=bw")
  MyConnection.Open() 
  MyConnection.Close() 
  return True
  End Function
  </code></pre>