S
Simon Harvey
Hi everyone,
I'm still abit confused about static methods accessing locally declared
variables.
For example
public static bool executeNonQuery(){
SqlCommand cmd;
SqlConnection con;
.....
}
Is the above threadsafe? Can the cmd or con object be accessed by more than
one thread at the same time.
What if the code was:
public static bool executeNonQuery(SqlCommand cmd){
SqlConnection con;
cmd.Connection = con;
.....
}
Where the command object is also created in a static calling method?
Many thanks all
Simon
I'm still abit confused about static methods accessing locally declared
variables.
For example
public static bool executeNonQuery(){
SqlCommand cmd;
SqlConnection con;
.....
}
Is the above threadsafe? Can the cmd or con object be accessed by more than
one thread at the same time.
What if the code was:
public static bool executeNonQuery(SqlCommand cmd){
SqlConnection con;
cmd.Connection = con;
.....
}
Where the command object is also created in a static calling method?
Many thanks all
Simon