Hi,
In the follow program I would like to have the parameter
"c" in method
"doSomething" as a value parameter, but it's
running as a reference
parameter. Why? How can I get parameter "c" as a
value (or clone,
copy)?
Current result:
value1
value2
Expected result:
value1
class Program
{
static void Main(string[] args)
{
SqlCommand sqlCommandSelect = new SqlCommand();
sqlCommandSelect.Parameters.AddWithValue(" col1", "value1");
doSomething(sqlCommandSelect.Parameters);
foreach (SqlParameter param in
sqlCommandSelect.Parameters)
{
Console.WriteLine(param.Value);
}
Console.ReadLine();
}
private static void doSomething(SqlParameterCollection c)
{
c.AddWithValue(" col2", "value2");
//I want to use the new value only here
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "C-Sharp (C#)" group.
To post to this group, send email to C_Sharp googlegroups.com
To unsubscribe from this group, send email to
C_Sharp-unsubscribe googlegroups.com
For more options, visit this group at http://g
roups.google.com/group/C_Sharp?hl=en
-~----------~----~----~----~------~----~------~--~---
|