title: How do I insert user inputs from asp.net textbox controls into SQL Server Database table?
body: <p>I'm in ASP.NET and coding in VB.<br>
  My SQL Server DB table name TempPurchases has 3 columns:<br>
   - ItemNumber (nvarchar(10),null)<br>
   - RDC (nvarchar(2),null)<br>
   - PurchaseQTY (int,null) </p>
  
  <p>The user inputs to go into the table are: ItemNumberTxtBox, DropDownList1, QuantityTxtBox<br>
  This is my code:</p>
  
  <pre><code>Protected Sub AddButton_Click(sender As Object, e As EventArgs) Handles AddButton.Click
     Dim CON As New SqlConnection("server=blahblah.com;database=databasename;User ID=fffffff;Password=*******;")
     Dim SQL As String = "INSERT INTO TempPurchases (ItemNumber, RDC, PurchaseQTY) VALUES (@ItemNumber, @RDC, @PurchaseQTY) "
     Dim CMD As New SqlCommand(SQL, CON)
  
     CMD.Parameters.Add(New SqlParameter("@ItemNumber", SqlDbType.NVarChar, 10))
     CMD.Parameters("@ItemNumber").Value = ItemNumberTxtBox.Text
  
     CMD.Parameters.Add(New SqlParameter("@RDC", SqlDbType.NVarChar, 2))
     CMD.Parameters("@RDC").Value = dropdownlist1.SelectedValue
  
     CMD.Parameters.Add(New SqlParameter("@PurchaseQTY", SqlDbType.Int))
     CMD.Parameters("@PurchaseQTY").Value = QuantityTxtBox.Text
  
     CON.Open()
     CMD.ExecuteNonQuery()
     CON.Close()
  End Sub
  </code></pre>
  
  <p>What am I doing wrong?  I'm not getting an error message but nothing is getting entered into the Database table.</p>