title: C# SQL Connection String problems
body: <p>I want to write a program using Visual Studio that allows the user to register and login using a SQL Server database. The problem is that the connection string that I get for my database doesn't seem to work. I've tried to modify it several times but it still doesn't work.</p>
  
  <pre><code>connection string = "Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename="C: \Users\H.Dani\Documents\glikDatabase.mdf";Integrated Security=True;Connect Timeout=30"
  </code></pre>
  
  <p>Do I need to use a SQL Server?</p>
  
  <p>EDIT: here's a part of the code.</p>
  
  <pre><code>// ESTABLISH CONNECTION TO DATABASE
  SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename='C: \Users\H.Dani\documents\visual studio 2015\Projects\Glik\Glik\glikData.mdf';Integrated Security=True");
  
  // TAKE FROM FIELDS AND ADD TO DATABASE
  String conReg = "insert into users(username,password) values('"+ textBox1.Text +"','"+ textBox2.Text +"')";
  
  con.Open();
  
  SqlCommand regCmd = new SqlCommand(conReg, con);
  regCmd.ExecuteNonQuery();
  
  MessageBox.Show("Successfully registered!");
  con.Close();
  
  textBox1.Clear();
  textBox2.Clear();
  textBox3.Clear();
  glikRegister();
  </code></pre>
  
  <p>This error appears at <code>con.Open()</code>:</p>
  
  <blockquote>
    <p>Additional information: An attempt to attach an auto-named database for file C:\Users\H.Dani\documents\visual studio 2015\Projects\Glik\Glik\glikData.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.</p>
  </blockquote>