SqlDataAdapter does not read input parameter to a stored procedure

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top