There is no cheat code to win the Pokemon Diamond lottery. The daily lottery (Jubilife TV) draws a random 5-digit ID; if it matches any Pokemon's OT ID in your party/PC, you win a prize (usually Moomoo Milk or Rare Candy).
~1/100,000 per Pokemon (5-digit match). With a full party + PC boxes, odds improve but remain minuscule. It's a novelty, not a progression system.
Diamond's postgame (Battle Tower, Pal Park, underground, competitive breeding) offers far more reward than a lottery ticket. Play fair—the satisfaction lasts longer.