Added query value subsitution
Fixed data invalid flag not being init'd. Throws record at DB
Records are added to the database
Records are added to the database
Updated error codes