Wednesday, March 21, 2012

how do i get the OUTPUT parameter value from a stored procedure that i am using to fill a

how do i get the OUTPUT parameter value from a stored procedure that i am using to fill a dataset?

Set the Direction property of your Parameter.

Dim myParamAs New SqlParameter' ... set value, name, etc.' if you are sending a value (Default)myParam.Direction = ParameterDirection.Input' if you are requesting a value (assigned in SQL)myParam.Direction = ParameterDirection.Output' if you are sending a value AND requesting' it's changed valuemyParam.Direction = ParameterDirectioin.InputOutput' If you want the return code for the SQLmyParam.Direction = ParameterDirection.ReturnValue
|||

no that doesn't work. i know how to use parameters, but i have only ever seen the Output Parameter used withcommand.executenonquery()when inserting data, but this is no good to me because I am only usingdataAdapter.Fill(myDataset)

how do i get the OutPut Parameter with only filling a dataset?

|||

Theoretically, after your call todataAdapter.Fill(myDataset)

the out parameter should be accessible using

dataAdapter.SelectCommand.Parameters("paramname")

I haven't tried it out though.

|||

Yes, this should work. I believe everything is copied by reference, though, when you add a parameter to a command, then a command to an adapter. Thus, you should still be able to use the original parameter.

'after dataadapter.fill()Dim strValueAs String = myParam.Value
|||I posted some sample code here. Check if it helps:http://forums.asp.net/thread/1478830.aspx|||thanks that works

No comments:

Post a Comment