title: Parameters issue with Insert Statement
body: <p>I get this error message from my <code>Try catch</code>:</p>
  
  <blockquote>
    <p>The parameterized query '(@UserID int, @date date, @BreakfastLevels float, @LunchLevels floa' expects the parameter '@UserID', which was not supplied</p>
  </blockquote>
  
  <p>The code is designed to take values put into a data grid view from a form and insert them to the table in the database however I get the error message above. I'm still quite new to coding and really need the help here.</p>
  
  <p>This is my code:</p>
  
  <pre><code> Private Sub UpdateButton_Click(sender As Object, e As EventArgs) Handles UpdateButton.Click
          Dim con As New SqlConnection(My.Settings.DiabetesServerConStr)
  
          Dim insertNewValues As New SqlCommand()
          insertNewValues.Connection = con
  
          insertNewValues.Parameters.Add("@UserID", SqlDbType.Int)
          insertNewValues.Parameters.Add("@Date", SqlDbType.Date).Value = Date.Today()
          insertNewValues.Parameters.Add("@BreakfastLevels", SqlDbType.Float)
          insertNewValues.Parameters.Add("@LunchLevels", SqlDbType.Float)
          insertNewValues.Parameters.Add("@DinnerLevels", SqlDbType.Float)
          insertNewValues.Parameters.Add("@BedLevels", SqlDbType.Float)
          insertNewValues.Parameters.Add("@BreakfastCarbs", SqlDbType.Float)
          insertNewValues.Parameters.Add("@LunchCarbs", SqlDbType.Float)
          insertNewValues.Parameters.Add("@DinnerCarbs", SqlDbType.Float)
          insertNewValues.Parameters.Add("@BreakfastInsulin", SqlDbType.Float)
          insertNewValues.Parameters.Add("@LunchInsulin", SqlDbType.Float)
          insertNewValues.Parameters.Add("@DinnerInsulin", SqlDbType.float)
  
          Dim parcomstr As String = "INSERT INTO BloodSugarDiary (UserID, Date, BreakfastLevels, LunchLevels, DinnerLevels, BedLevels, BreakfastCarbs, LunchCarbs, DinnerCarbs, BreakfastInsulin, LunchInsulin, DinnerInsulin)VALUES (@UserID, @Date, @BreakfastLevels, @LunchLevels, @DinnerLevels, @BedLevels, @BreakfastCarbs, @LunchCarbs, @DinnerCarbs, @BreakfastInsulin, @LunchInsulin, @DinnerInsulin)"
          insertNewValues.CommandText = parcomstr
  
          Try
              con.Open()
              insertNewValues.ExecuteNonQuery()
              con.Close()
          Catch ex As Exception
              MsgBox(ex.Message)
          End Try
          con.Dispose()
      End Sub
  </code></pre>