SqlDataAdapter does not read input parameter to a stored procedure

  • Thread starter Thread starter Rocio
  • Start date Start date
R

Rocio

I have this piece of code and keep getting error:

System.Data.SqlClient.SqlException: Procedure 'web_GetTransaction'
expects parameter '@PaymentStatus', which was not supplied.

it crashes right after objDA.Fill(objDS) below, any ideas why?

The only new thing is that, I'm running this from a console
application.

Please your promp help will be very appreciated.


Dim objDS As DataSet
Dim objCommand As SqlCommand
Dim objParam As SqlParameter
Dim objConn As New SqlClient.SqlConnection
Dim objDA As SqlDataAdapter
Dim dr As DataRow

Try
objConn.ConnectionString = Utilities.GetFromWebConfig
'specify the main SP & its parameters to execute
objCommand = New SqlCommand("web_GetTransaction", objConn)
objCommand.CommandType = CommandType.StoredProcedure
objCommand.Parameters.Clear()
objCommand.Parameters.Add(New SqlParameter("@PaymentStatus", 0))
objCommand.Connection.Open()
objDA = New SqlClient.SqlDataAdapter(objCommand)
objDS = New DataSet
objDA.Fill(objDS)
Catch ex As Exception
console.writeline ex.tostring
Finally
objConn.Close()
objConn = Nothing
objCommand = Nothing
End Try
 
Back
Top