title: Failing SQL insert
body: <p>I wonder if someone could help me with this SQL insert query?   I've a nasty suspicion that I am staring at something very obvious, but I've been trying to figure it out for a while now, and I can't see what's wrong.  At the moment it just drops through to the catch loop when I try and execute.   I'm using Visual studio Community 2015.   Incidentally, is there anywhere in VS where you can try out a SQL statement?</p>
  
  <p>Here's the code</p>
  
  <pre><code>    private void button1_Click(object sender, EventArgs e)
      {
          try
          {
              SqlConnection myConnection = new SqlConnection(@"Data Source = (LocalDB)\MSSQLLocalDB; AttachDbFilename = ""C:\Users\Nick\Documents\Investments 4.mdf""; Integrated Security = True; Connect Timeout = 30");
              myConnection.Open();
              if (myConnection.State == ConnectionState.Open)
              {
                  MessageBox.Show("Connection Open");
              }
  
              SqlCommand myCommand3 = new SqlCommand();
              myCommand3.CommandType = System.Data.CommandType.Text;
              myCommand3.CommandText = "INSERT INTO Dbo.Values (Portfolio Name,Date,Daily Value,Daily Percent) VALUES ('Ascentric',@SQLTime,2000,0.01)";
              //myCommand.Parameters.Add("@SQLPortName", System.Data.SqlDbType.NVarChar);
              //myCommand.Parameters["@SQLPortName"].Value = "Eric";
              myCommand3.Parameters.Add("@SQLTime", System.Data.SqlDbType.DateTime );
              myCommand3.Parameters["@SQLTime"].Value = DateTime.Today;
              myCommand3.ExecuteNonQuery();
              myConnection.Close();
          }
  
          catch
          {
              MessageBox.Show("Nope.  Didn't work");
          }
  
  
  
      }
  </code></pre>
  
  <p>And here's the table:</p>
  
  <p><a href="https://i.stack.imgur.com/81EWP.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/81EWP.jpg" alt="enter image description here"></a></p>
  
  <p>By the way, I do understand that I need to parameterise this, but I am just trying to get the basic statement to work at the moment.</p>
  
  <p>Any help gratefully received!</p>