title: Having trouble connecting to a SQL Server database in ASP .NET
body: <p>I have created a user (<code>surveyapp</code>) in the database and server (and put in the master database), as you can see here: <a href="http://i.imgur.com/f08O8AI.jpg" rel="nofollow">http://i.imgur.com/f08O8AI.jpg</a></p>
  
  <p>I've also given that user as many permissions as I can on the table I'm trying to query: <a href="http://i.imgur.com/kDRtoSt.jpg" rel="nofollow">http://i.imgur.com/kDRtoSt.jpg</a></p>
  
  <p>And finally here is the code that's not working. It says </p>
  
  <blockquote>
    <p>Additional information: Login failed for user 'surveyapp'</p>
  </blockquote>
  
  <p>when it tries to run:</p>
  
  <pre><code>using (var conn = new SqlConnection("Server = tcp:k4i7bteriv.database.windows.net,1433; Database = Survey Database; User ID = surveyapp@k4i7bteriv; Password ={********}; Trusted_Connection = False; Encrypt = True; Connection Timeout = 30; "))
  {
      conn.Open();
      var cmd = conn.CreateCommand();
      cmd.CommandText = @"INSERT INTO dbo.dataset (Gender, Age, Drink_Freq, Show_source) VALUES ('" + Gender.SelectedItem.Text + "', '" + Age.SelectedItem.Text + "', '" + Drinks.SelectedItem.Text + "', '" + Show.SelectedItem.Text + "');";
      cmd.ExecuteNonQuery();
  }
  </code></pre>
  
  <p>(the *****'s are the actual password in the code, I just removed it in this snippet)</p>
  
  <p>I've done all the permissions stuff I can think of, and I don't know why it won't connect. It does this whether I have it running via localhost, or if I publish it to Azure and run it off the web, so it's not a firewall issue. I was up until 6am last night trying madly to figure this out, to no avail :( any assistance is greatly appreciated</p>