title: Connecting to local sql server in vb.net - Error Connecting and difference between Local and Commercial?
body: <p>I am a developer building websites in VB.Net using Visual Studio 2010. I am trying to populate some fields when a user visits a website based on their decisions on a previous screen.</p>
  
  <p>My connection information is as follows: </p>
  
  <pre><code>Dim myDataReader As SqlDataReader
  Dim myConnection As SqlConnection
  Dim myCommand As SqlCommand
  Dim strSQL As String
  
  myConnection = New SqlConnection("Data Source=localhost\sqlexpress; Database=PREP; Integrated Security=SSPI;")
  Try
      myConnection.Open()
  Catch ex As Exception
      MsgBox(ex.Message)
  End Try
  
  strSQL = "SELECT * FROM Charts where ID=1"
  
  myCommand = New SqlCommand(strSQL, myConnection)
  
  myDataReader = myCommand.ExecuteReader()
  
  If myDataReader.Read() Then
      TextBox1.Text = myDataReader.Item("Priority1")
  Else
      MsgBox("Didn't work...")
  End If
  </code></pre>
  
  <p>The error I continue to get is: </p>
  
  <blockquote>
    <p>Cannot open database "PREP" by the login. The login failed. Login failed for user 'OR-AA-Me\Me'</p>
  </blockquote>
  
  <p>I assumed that since it was a local database I would not need a username and password. Am I wrong?</p>
  
  <p>Also, are there glaring practices in the above code that will be unwise when I transport this to a commercial environment?</p>
  
  <p>Thanks!</p>