I need an advanced validation to validate entries in textboxes even before it opens the database to check entries or input in database

I am creating a database which should allow no empty names or not valid email addresses but my program validates alright but opens the database and inputs the wrong data even after collecting errors

Any help would be much appreciated