If you assign a parameter to your command, your stored procedure must accept the parameter. In addition, if you specify the direction as Output , then you should mark this parameter as Output in the stored procedure.
If you want the results of the stored procedure to accept no parameters, delete all rows containing sqlParReturn1 . In addition, your team is not a โno-requestโ - you request data. To get this you have to do it (I also reorganized your code using some best practices):
Using connSql As SqlConnection = New SqlConnection(...) connSql.Open() Using myCommandSQL As SqlCommand = connSql.CreateCommand() myCommandSQL.CommandType = CommandType.StoredProcedure myCommandSQL.CommandText = "Select_Prod" Using reader As SqlDataReader = myCommandSQL.ExecuteReader() If reader.HasRows Then While reader.Read() // loops through the rows returned End While End If End Using End Using End Using
source share