title: An exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll but was not handled in user code error?
body: <p>When trying to insert the following information into my database I get "An exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll but was not handled in user code error?" error.</p>
  
  <p>My code is as follows:</p>
  
  <pre><code>Imports System.Data.SqlClient
  Partial Class SecurePages_AddBackup
  Inherits System.Web.UI.Page
  
  Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  
      Dim conn As SqlConnection
      Dim cmd As SqlCommand
  
      Dim customer As Integer
      Dim backupDate As String
      Dim Server As Integer
      Dim Status As String
      Dim Product As Integer
      Dim Details As String
  
      customer = ddlCustomer.SelectedValue
      backupDate = clDate.SelectedDate
      Server = DDLserver.SelectedValue
      Status = DDLStatus.Text
      Product = DDLproduct.SelectedValue
      Details = txtDetails.Text
  
  
  
  
      Dim cmdstring As String = "INSERT INTO Backup(CustomerID, Date, ServerID, Status, ProductID, Details) Values (@Customer, @BackupDate, @Server, @Status, @Product, @Details)"
  
      conn = New SqlConnection("Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\Backups.mdf;Integrated Security=True")
      cmd = New SqlCommand(cmdstring, conn)
  
      cmd.Parameters.AddWithValue("@Customer", customer)
      cmd.Parameters.AddWithValue("@BackupDate", backupDate)
      cmd.Parameters.AddWithValue("@Server", Server)
      cmd.Parameters.AddWithValue("@Status", Status)
      cmd.Parameters.AddWithValue("@Product", Product)
      cmd.Parameters.AddWithValue("@Details", Details)
      conn.Open()
  
      cmd.ExecuteNonQuery()
  
  
  
  
      conn.Close()
  
      lblStatus.Text = "Backup added to the database!"
  End Sub
  End Class
  </code></pre>
  
  <p>I'm not sure where I am going wrong.</p>