I have a stored procedure that returns a varchar(160) as an output parameter of a stored procedure.
Everything works fine when i use ExecuteNonQuery, i always get back the expected value.
However, once i switch to use BeginExecuteNonQuery, i get a null value for the output.
I am using connString + "Asynchronous Processing=true;" in both cases.
Sadly the BeginExecuteNonQuery is about 1.5 times faster in my case...but i really need the output parameter.
Thanks!
EDIT:This is how i am processing the BeginExecuteNonQuery callback (i am using .net 4.0...)
Dim resp as String=""
cmd.BeginExecuteNonQuery(Sub(result As IAsyncResult)
Dim c As SqlCommand = Nothing
Try
c = CType(result.AsyncState, SqlCommand)
c.EndExecuteNonQuery(result)
**resp = CStr(c.Parameters("@response").Value)**
Catch ex As Exception
WriteLog("ERR - LogRequest - " & ex.Message)
Finally
c.Connection.Close()
c.Dispose()
End Try
End Sub, cmd)