title: Problem calling a stored procedure from VB.NET
body: <p>I am pretty new to VB and I am not sure why this is not working, basically I am trying to run a stored procedure from my web code. The sp runs just fine in SQL, I've tried it several times so I am sure that is not the problem. I don't want to return any results, I just want to see an "ok" statement if it runs and an error message if it doesn't. The code I am using for the lables (warnings and confirmation) is reused from earlier on the same page, the same goes for the validations (valUpload). I am sure the solution is simple...</p>
  
  <pre><code>Protected Sub RunValidation_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles RunValidation.Click
      Try
          Dim bl As New BL.ORG
          Dim db As Database = DatabaseFactory.CreateDatabase("MyConnection")
          Dim dbCommand As DbCommand
  
          db = DatabaseFactory.CreateDatabase("MyConnection")
          dbCommand = db.GetStoredProcCommand("Company.dbo.uspMyStoredProcedure")
          dbCommand.CommandTimeout = 300
          db.AddInParameter(dbCommand, "ClientID", DbType.String, ddlCompany.SelectedValue)
          db.AddInParameter(dbCommand, "startPeriod", DbType.String, ddlStartPeriod.SelectedValue)
          db.ExecuteDataSet(dbCommand)
  
          lblWarning.Text = "Please confirm that the &lt;strong&gt;ClientID and startPeriod &lt;/strong&gt; are populated in the dropdown list."
          lblWarning.Visible = True
          lblConfirmation.Visible = False
  
      Catch ex As Exception
          valUpload.ErrorMessage = "There has been an unexpected error generating the page&lt;br&gt;(" + Err.Description + ")"
          valUpload.IsValid = False
      End Try
  End Sub
  </code></pre>