title: INSERT query not working vb.net sql
body: <p>I am working on a project!
  M using vb 2012 with .mdf as database!</p>
  
  <p>Problem is M unable to save record to database using the sql insert statement!
  PFB "app.config" | "insert code (save button click event)", and help me out!
  Its small mistake but m unable to crack it!</p>
  
  <pre><code>app.config--&gt;
  &lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
  &lt;configSections&gt;
  &lt;/configSections&gt;
  &lt;connectionStrings&gt;
      &lt;add name="SQLConnStr" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\balancesheet.mdf;Integrated Security=True"
          providerName="System.Data.SqlClient" /&gt;
  
  &lt;/connectionStrings&gt;
  &lt;startup&gt;
      &lt;supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /&gt;
  &lt;/startup&gt;
  &lt;/configuration&gt;
  
    insert query--&gt;&gt;
  
   Private Sub Button5_Click(sender As Object, e As EventArgs) Handles saveexp.Click
      If descexp.Text &lt;&gt; "" And amountexp.Text &lt;&gt; "" Then
          Dim SQLConnStr As New SqlConnection
          Dim Company As String = ""
          SQLConnStr.ConnectionString = ConfigurationManager.ConnectionStrings("SQLConnStr").ConnectionString()
          Dim cmd As New SqlCommand
          If SQLConnStr.State = ConnectionState.Broken Or SQLConnStr.State = ConnectionState.Closed Then
              SQLConnStr.Open()
          End If
          cmd.Connection = SQLConnStr
          cmd.CommandText = "insert into Expense (date,Description,Amount) values('" &amp; expdate.Value &amp; "', '" &amp; descexp.Text &amp; "','" &amp; amountexp.Text &amp; "')"
          cmd.ExecuteNonQuery()
      End If
  
  End Sub
  </code></pre>