SyntaxFix
Write A Post
Hire A Developer
Questions
You need to close the connection before you can use the output parameters. Something like this
con.Close(); MessageBox.Show(cmd.Parameters["@code"].Value.ToString());