1

I have a method that uses output from a stored procedure as input to another.

ObjectParameter output = new ObjectParameter("IncidentID",typeof(Int32));
_db.InsertInitialInfo(startTime, endTime, output);

//int outputInt = Convert.ToInt32(output);  ---> Doesnt work -  
                                        System.InvalidCastException
List<string> errorList = _db.GetErrorMessage(outputInt).ToList();

How do I convert the ObjectParameter that has an integer value into an integer?

1 Answer 1

3

You should use Value property of ObjectParameter and cast it to integer:

int outputInt = (int) output.Value;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.