title: Unable to execute ConnectionString in MS visual Studio 2010
body: <p>I've been stuck with this for the past week and would be very glad if you guys could help.</p>
  
  <p>I'm working on vb with MS visual studio 2010. I currently have a database under a asp.net folder named "app_data". </p>
  
  <p>I'm trying to execute a connectionString command via web.config file.</p>
  
  <p>Web Config:</p>
  
  <pre><code>&lt;connectionStrings&gt;
      &lt;add name="mysqlcon" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\public.mdf;Integrated Security=True;User Instance=True"
        providerName="System.Data.SqlClient" /&gt;
    &lt;/connectionStrings&gt;
  </code></pre>
  
  <p>Main code:</p>
  
  <pre><code> Dim a As String = ConfigurationManager.ConnectionStrings("mysqlcon").ConnectionString
          Dim conn As New MySqlConnection(a)
  
  
  
          Try
  
  
              conn.Open()
              MsgBox("good")
  
              conn.Close()
          Catch ex As MySqlException
              MsgBox(ex.Message)
          Finally
              conn.Dispose()
  
          End Try
  </code></pre>
  
  <p>I'm getting the following error(line 10 is being highlighted): </p>
  
  <pre><code>Server Error in '/MP' Application.
  
  Keyword not supported.
  
  Parameter name: attachdbfilename
  
  
  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
  
  Exception Details: System.ArgumentException: Keyword not supported.
  Parameter name: attachdbfilename
  
  Source Error:
  
  
  Line 8:      Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
  Line 9:          Dim a As String = ConfigurationManager.ConnectionStrings("mysqlcon").ConnectionString
  Line 10:         Dim conn As New MySqlConnection(a)
  Line 11: 
  Line 12: 
  
  
  
  Stack Trace:
  
  
  [ArgumentException: Keyword not supported.
  Parameter name: attachdbfilename]
     MySql.Data.MySqlClient.MySqlConnectionStringBuilder.ValidateKeyword(String keyword) +108
     MySql.Data.MySqlClient.MySqlConnectionStringBuilder.set_Item(String keyword, Object value) +18
     System.Data.Common.DbConnectionStringBuilder.set_ConnectionString(String value) +185
     MySql.Data.MySqlClient.MySqlConnection.set_ConnectionString(String value) +289
     MySql.Data.MySqlClient.MySqlConnection..ctor(String connectionString) +26
     test.Button1_Click(Object sender, EventArgs e) in C:\Users\God\Desktop\VB\MP\test.aspx.vb:10
     System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
     System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
     System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
     System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
     System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
     System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
  </code></pre>
  
  <p>Would be glad if you guys can help.</p>