I made a form subscribe form. when inserting data i will put the subscribe date and time there.
Should we put the subscribe date time in code behind or in mssql server as a default value.
I made a form subscribe form. when inserting data i will put the subscribe
Share
I think this is personal choice though I always do this kind of thing in SQL using
CURRENT_TIMESTAMPMy reasoning is why bother adding an extra parameter to your query that is not really needed, its just extra data you have to generate.
As has been mentioned adding it in codebehind might aid in code readability but I disagree, when you call a procedure you dont always need to know what it is storing and how it does it, you just need to know what it does.
As an example I have a lot of procedures that edit things in my database and as a side task they also update audit tables so I have a log of what is being done. Which ever programmer calls these procedures doesnt need to know this as the procedures primary function is to insert or edit data in a main table, the audit trail that is generated is just data about data and not relevant to what this programmer is doing.
If I were to add all the audit parameters to each of these SPs in code behind then there would be 5-6 extra parameters which just clutter up my codebehind and complicate things even more.
In your scenario does the person inserting the data into your database need to know that it logs the time the data is inserted? Im guessing probably not so there is no real need to generate the date in codebehind.