4b0
4b0

Reputation: 22323

Unable to catch scope_identity through KeyValuePair asp.net

i try:

List<KeyValuePair<string, object>> ParamCollOutput= new List<KeyValuePair<string, object>>();
ParamCollOutput.Add(new KeyValuePair<string, object>("@MenuID", SqlDbType.Int));
ParamCollOutput.Direction = ParameterDirection.Output;

but i got a error in Direction.Does not contain a defn for....I know its not a valid way to declare but how should i get the value and assign it in int a.SP is not a problem.Thanks for a help.

Upvotes: 1

Views: 92

Answers (1)

dknaack
dknaack

Reputation: 60506

List<T> does not implement Direction.

I think you want to do this...

SqlParameterCollection coll = new SqlParameterCollection();
coll.Add(new SqlParameter("@MenuId", 123) { Direction = ParameterDirection.Output });

Upvotes: 3

Related Questions