Making a small page that calls a SQL stored Proc with only one parameter, which the user would enter in a text box. In declaring that parameter, it is giving me the error above. Can anyone assist? The error is on the CMD.Parameters line..
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim CMD As New SqlCommand("daily_revenue_rerun")
CMD.Parameters("@date", SqlDbType.DateTime).value = TextBox1.Text
Dim connection As SqlConnection = New SqlConnection
connection.ConnectionString = "Data Source=azda-sql0;Persist Security Info=True;User ID=sa;Password=Sql@dm!n;Initial Catalog=RevenueTrakSQL"
CMD.Connection = connection
CMD.CommandType = CommandType.StoredProcedure
Dim Adapter As New SqlDataAdapter(CMD)
Dim DS As DataSet
Adapter.Fill(DS)
connection.Close()
End Sub
Thanks for any assistance..
Look at your parameter binding. What I can see is that your stored proc daily_revenue_rerun
expects a DATETIME
datatype variable whereas you are passing a string
CMD.Parameters("@date", SqlDbType.DateTime).value = TextBox1.Text