>>>>>>>>>
>>>>>>>>>Given your previous post I guess you no longer need it but, in pseudo-code:
SqlCommand command = new SqlCommand();
>>>>>>>>> //Congfigure command
>>>>>>>>> SqlParameter param = new SqlParameter(Parameters[2, 0], Parameters[2, 1]);
>>>>>>>>> param.Direction = ParameterDirection.InputOutput;
>>>>>>>>> //etc
>>>>>>>>> command.Parameters.Add(param);
>>>>>>>>> //Add other params , execute....
>>>>>>>>> var v = command.Parameters["@Param3"].Value;
>>>>>>>>
>>>>>>>>Can you think of why when I am trying to apply the above code, C# compiler complaints that 'object does not contain a definition for 'Value'". This is on the very last line where Parameters value is retrieved. And when I entry the open bracket key, right after the 'Parameters' Intellisense shows that object List parameter is int Index. What am I missing?
>>>>>>>
>>>>>>>Can you show the code you're trying?
>>>>>>
>>>>>>I think the difference is in how I create Parameters collection (as following):
>>>>>>
>>>>>>
>>>>>>IDbDataParameter param = oCommand.CreateParameter();
>>>>>>
>>>>>>
>>>>>>and the way Viv created them:
>>>>>>
>>>>>>
>>>>>>SqlParameter param = new SqlParameter(Parameters[2, 0], Parameters[2, 1]);
>>>>>>
Not sure why that wouldn't work. Assuming the command is DBCommand where does your code differ from this:
System.Data.Common.DbCommand command = new SqlCommand();
>>>>> System.Data.IDbDataParameter p = command.CreateParameter();
>>>>> p.ParameterName = "@Param3";
>>>>> p.Direction = ParameterDirection.InputOutput;
>>>>> p.Value = cVal3;
>>>>> //etc...
>>>>> command.Parameters.Add(p);
>>>>> var v = command.Parameters["@Param3"].Value;
>>>>
>>>>My code is almost exactly as you have it. In place of your //etc I call oCommand.ExecuteNonQuery() (and I tried oCommandExecuteScalar() but the same result). But obviously since this code work for you, I am missing something.
>>>>
>>>>Question. When you press '[' after the Parameters (last line) what does your Intellisense show?
>>>
>>>1 of 2:
>>>System.Data.Common.DbParameter DbParameterCollection[int index]
>>>System.Data.Common.DbParameter DbParameterCollection[string parameterName]
>>>
>>>I'm using the second. What happens if you split it:
var v = command.Parameters["@Param3"];
>>> var v2 = v.Value;
>>
>>I get compiler errors. Let me ask you, what tpe is your var "v"? I also get error on the "var"; what is it?
>
>'command' was a DbCommand so it's cast to System.Data.Common.DbParameter - but since the Command instance was SqlCommand it's actually System.Data.SqlClient.SqlParameter.
>i.e. In the debugger: System.Data.Common.DbParameter {System.Data.SqlClient.SqlParameter}
Thank you for the explanation.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham