Procedure or function “” expects parameter “”, which was not supplied

后端 未结 2 1472
青春惊慌失措
青春惊慌失措 2020-12-21 05:28

i am new on asp.net with vb.code behind

i am trying get value from sql

my code

Dim apps As New MyApps
apps.OpenConnection()

Dim esql As New         


        
相关标签:
2条回答
  • 2020-12-21 05:44

    You are executing the procedure before you are telling the command that it is an output parameter, by default it assumes it is an input parameter.:

    esql.Parameters("@value").Direction = ParameterDirection.Output
    esql.ExecuteNonQuery()
    
    0 讨论(0)
  • 2020-12-21 05:47

    try by interchanging the two lines.

    esql.CommandText = "cekdatauploads"
    esql.Parameters.Add("@value", SqlDbType.Int, 2)
    esql.Parameters("@value").Direction = ParameterDirection.Output
    esql.ExecuteNonQuery()
    

    one more thing if, cekdatauploads is a strored procedure, you should declare it in the CommandType

    esql.CommandType = CommandType.StoredProcedure
    esql.CommandText = "cekdatauploads"
    esql.Parameters.Add("@value", SqlDbType.Int, 2)
    esql.Parameters("@value").Direction = ParameterDirection.Output
    esql.ExecuteNonQuery()
    
    0 讨论(0)
提交回复
热议问题