title: Get back @html.dropdownlist ID value for database insert / update in Webmatrix
body: <p>I have build some dropdown lists using the LINK to Objects method and @html.dropdownlist Webmatrix helper. This works fine.</p>
  
  <p>I want to know <code>how to pass / store the selected value in my database table</code>.</p>
  
  <p><strong>Build of items list in code section</strong></p>
  
  <pre><code>var titlesData = db.Query("SELECT TitleId, Name FROM Titles ORDER BY Name");
          titlesListItems = titlesData.Select(i =&gt; new SelectListItem {
          Value = i.TitleId.ToString(),
          Text = i.Name,
          Selected = i.TitleId == providerData.TitleId ? true : false
          });
  </code></pre>
  
  <p><strong>HTML markup section:</strong></p>
  
  <pre><code>@Html.DropDownList("titlesCombo","-- Veuillez sélectionner -- ",titlesListItems)
  </code></pre>
  
  <p><strong>Database update command (see the ???)</strong>:</p>
  
  <pre><code>db.Execute("UPDATE Providers SET TitleId=@0 WHERE ProviderId=@1",???,providerId)
  </code></pre>
  
  <p>The method I used for now is to create another variable:</p>
  
  <pre><code>var titleId = "";
  
  if (!IsPost) {
  
      titleId = providerData.TitleId.ToString(); //providerData stores the SQL query result
  }
  
  if (IsPost) {
  
      var titleId = Request.Form[TitleID]
      db.Execute("UPDATE Providers SET TitleId=@0 WHERE ProviderId=@1",titleId,providerId)
  }
  </code></pre>
  
  <p><strong>Unfortunately, data doesn't get updated</strong></p>