So you are sending them an email with the code, and you then have a form where they enter the code?
Ok, so on the form page add a recordset to look up the code in the database.
then add a set session value behavior to the page to set a session named "WinningCode"
For the value, click the lightning bolt icon and select the code column from the recordset.
add a second set session value behavior to the page, for the trigger and the value, click the lightning bolt icon and select the code form element.
Set the name to EnteredCode
In the Rule, use the WinningCode session as the Value, and the Entered code session as the Comparison