Use int.TryParse instead of int.Parse to process user input, and check all fields as early as possible so you don't waste effort with things that aren't going to happen.
int id;
public void myMethod()
{
if (!int.TryParse(txtId.Text, out id))
{
return;
}
SqlConnection con = new SqlConnection(Helper.ConnectionString);
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
...
Then use the checked-and-fine
id
value in your parameters
I would suggest though, that you use AddWithValue instead:
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Id", id);