Quote:
cmd.Connection = conn;
You've declared your connection object as "con" and then told your command object to use a connection object called "conn".
Since this actually compiled, it appears you've got another connection object called "conn" somewhere above this in the same scope or in a higher level scope. That would be bad practice to have that.