title: Creating a select list from a database
body: <p>I am trying to have a select element in my form pull a list of names for the user to choose from, though my prior knowledge doesn't seem correct anymore.</p>
  
  <p>Here's a summarized view of what i'm looking at right now.</p>
  
  <pre><code>@{
  var productName = Request["ProductName"];
  var productSupplierID = Request["SupplierID"];
  var productCategoryID = Request["CategoryID"];
  var productQuantity = Request["QuantityPerUnit"];
  var productUnitPrice = Request["UnitPrice"];
  
  var db = Database.Open("ProfessionalXM_DB");
  
  var supplierQuery = "SELECT SupplierID, CompanyName FROM Suppliers ORDER BY CompanyName";
  var categoryQuery = "SELECT CategoryID, CategoryName FROM Categories ORDER BY CategoryName";
  
  var productSupplierName = Request["CompanyName"];
  var productCategoryName = Request["CategoryName"];
  
  var supplies = db.Query(supplierQuery, productSupplierID);
  var categories = db.Query(categoryQuery);
  
  
  if (IsPost)
  {
      var productsQuery = "INSERT INTO Products (ProductName, SupplierID, CategoryID, QuantityPerUnit, UnitPrice, UnitsInStock,UnitsOnOrder, ReorderLevel, Discontinued) VALUES(@0, @1, @2, @3, @4, 0, 0, 0, 0)";
      try
      {
          db.Execute(productsQuery, productName, productSupplierID, productCategoryID, productQuantity, productUnitPrice);
      }
      catch (Exception ex)
      {
          &lt;p&gt;Error! @ex.Message&lt;/p&gt;
      }
  }
  
  
  &lt;div class="col-md-12"&gt;
  &lt;form method="post"&gt;
      &lt;label&gt;Name&lt;/label&gt;
      &lt;input type="text" name="productName" required value="@productName" class="form-control" /&gt;
  
      &lt;label&gt;Supplier&lt;/label&gt;
      &lt;select name="productSupplier" required&gt;
          &lt;option&gt;@*Problem lies here*@&lt;/option&gt;
      &lt;/select&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p></p>
  
  <p>Any solution I can find online is in javascript or something else which unfortunately not allowed in this case.</p>
  
  <p>Any help would be much appreciated!</p>