Your code could work. You need to check whether those items Valery Possoz mentioned are correct. And if you want to "Dispose()", not only "Close()", perhaps, to construct like this is better:
using (SqlConnection sqlCon = new SqlConnection(SqlConnectionString))
{
SqlCommand sqlcmd = sqlCon.CreateCommand();
sqlcmd.CommandType = CommandType.StoredProcedure;
sqlcmd.CommandText = "USP_CreateCatagory";
SqlParameter CatagoryName11 = new SqlParameter
{
ParameterName = "CatagoryName",
Value = CategoryName,
SqlDbType = SqlDbType.VarChar,
Direction = ParameterDirection.Input
};
SqlParameter oUtputParam = new SqlParameter
{
ParameterName = "@CatagoryId",
SqlDbType = SqlDbType.Int,
Direction = ParameterDirection.Output
};
sqlcmd.Parameters.Add(CatagoryName11);
sqlcmd.Parameters.Add(oUtputParam);
try
{
sqlCon.Open();
sqlcmd.ExecuteNonQuery();
}
catch { }
}