我是在asp.net上的新手,后面有vb.code
我正在尝试从sql获取价值
我的密码
Dim apps As New MyApps apps.OpenConnection() Dim esql As New SqlCommand esql.Connection = apps.oConn esql.CommandText = "cekdatauploads" esql.Parameters.Add("@value", SqlDbType.Int, 2) esql.ExecuteNonQuery() esql.Parameters("@value").Direction = ParameterDirection.Output Dim nilai As Integer = esql.Parameters("@value").Value apps.CloseConnection()
错误是
The parameterized query '(@value int)cekdatauploads' expects the parameter '@value', which was not supplied.
我已经尝试执行商店程序
declare @p int exec [cekdatauploads] @p output print @p
并返回0非空值。
提前致谢!
尝试通过互换两条线。
esql.CommandText = "cekdatauploads" esql.Parameters.Add("@value", SqlDbType.Int, 2) esql.Parameters("@value").Direction = ParameterDirection.Output esql.ExecuteNonQuery()
如果cekdatauploads是受支持的过程,还有一件事情,您应该在CommandType
cekdatauploads
CommandType
esql.CommandType = CommandType.StoredProcedure esql.CommandText = "cekdatauploads" esql.Parameters.Add("@value", SqlDbType.Int, 2) esql.Parameters("@value").Direction = ParameterDirection.Output esql.ExecuteNonQuery()