Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Should code for checks be on form or in store procedures
Message
From
27/10/2005 06:32:10
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01062538
Message ID:
01062551
Views:
16
>I would like to know what is the best practice to check that data on an entry form is correct and what are the advantages and disadvantages of each?
>
>I have seen this type of checking in one of 3 places:
>
>1) At the point where the data is captured (for example in the valid event of say a text box.

That is nice for the user. Do not let him enter data that will be rejected on the save

>2) A number of check are done in a method on the form. This method is called before the tableupdate is issued.

Also nice

>3) Checks are written into a stored procedure. This procedure is then called each time before the referential integrity is run for a trigger in the table.

This is the place where the checks have to be. One part goes in the table validation rule. Ref integrity is handled by triggers. You can add a trigger for other checks
I'm saying that this is THE place, because the this is the last stop before that data finally gets written/comitted

It is also kind of defensive for the programmer. The data in the database is always checked no matter where it came from (form1, form2, browse, ...)
If you have forgotten something on your form, in a new form, or any other place, you will be remembered when the data is saved

So, I would say 3) because the checks are at the last gate before the save and because they are only in one place


>Thanks in advance!
Gregory
Previous
Reply
Map
View

Click here to load this message in the networking platform