title: VB.NET Simultaneous connections LocalDB Database
body: <p>I've been using some LocalDB databases (.mdf files). I've been the only one using those DB for a while, but more and more are using it now. Every time we use the app at the same time we have an error because we connect to the DB at the same time.</p>
  
  <p>Is there a way to allow simultaneous connections to an SQL LocalDB database?
  If not what is the best alternative assuming we will never have more than 5 people connecting at the same time?</p>
  
  <p>Here is the code i'm suing to acess my DB file :</p>
  
  <pre><code>Public Shared Function SQLQuery(query As String, connectionString As String, tableName As String)
      Dim cn As New SqlConnection(connectionString)
      Dim cm As New SqlCommand(query, cn)
      Dim adp As New SqlDataAdapter(cm)
      Dim ds As New DataSet
      adp.Fill(ds, tableName)
      adp.Dispose()
      cm.Dispose()
      cn.Close()
      SQLQuery = ds
  End Function
  </code></pre>
  
  <p>And here is an example of connection string :</p>
  
  <pre><code>Public Shared connectionStringScreenDataDB As String = "Data Source=(LocalDB)\v11.0;AttachDbFilename='P:\Clement\Visual Studio\PanoramaFund2App\PanoramaFund2App\ScreenDataDB.mdf';Integrated Security=True"
  </code></pre>