title: Database Connection error
body: <p>I have win application and i get this error when i want to connect the database to my app
  error:</p>
  
  <blockquote>
    <p>An attempt to attach an auto-named database for file C:\Users\Aren\Desktop\DB\REGISTRATION.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.</p>
  </blockquote>
  
  <pre><code>public class DALBase
  {
      protected SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\\Users\\Aren\\Desktop\\DB\\REGISTRATION.mdf;integrated Security=true ; User Instance=True");
      protected SqlCommand com = new SqlCommand();
      protected SqlDataAdapter da = new SqlDataAdapter();
      protected DataSet ds = new DataSet();
  
  }
  </code></pre>
  
  <hr>
  
  <pre><code>public DataSet GetStudent(string filter)
      {
  
          DataSet dset = new DataSet();
          using (SqlCommand cmd = new SqlCommand())
          {
              string cmdstring = string.Format("Select * from {0}"
                 , Common.Data.Student.Table_Name);
  
  
              if (!string.IsNullOrEmpty(filter)) cmdstring += " where " + filter;
  
  
              cmd.CommandText = cmdstring;
              cmd.Connection = this.con;
              cmd.Connection.Open();
              cmd.CommandText = cmdstring;
              cmd.Connection = this.con;
              SqlDataAdapter adapter = new SqlDataAdapter(cmd);
              adapter.Fill(dset, Common.Data.Student.Table_Name);
              return dset;
          }
      }
  </code></pre>
  
  <p>NOTE: ALSO i got 3 project in my solution the DALBASE and GETSTUDENT methods are in one project and i call them from other project to get the data for me.</p>