locked
How to: Insert DateTime.Now of the server side not client side? RRS feed

  • Question

  • Hi,

    How can I Insert "DateTime.Now" of the server side not client side into database?

    I'm using 'Saving' method to assign the dateTime, but I'm not sure if its the server dateTime or the client DateTime.

    Thanks,

    Friday, June 7, 2013 10:44 PM

Answers

  • The <ScreenName>_Saving method is still a client-side method. You want to use the <EntitySetName>_Inserting and <EntitySetName>_Updating methods (you can get access to these from the entity designer's Write Code drop down) to set the DateTime value while on the server.

    Justin Anderson, LightSwitch Development Team

    • Marked as answer by H. ALFADL Saturday, June 8, 2013 11:22 PM
    Saturday, June 8, 2013 8:41 PM
    Moderator

All replies

  • The <ScreenName>_Saving method is still a client-side method. You want to use the <EntitySetName>_Inserting and <EntitySetName>_Updating methods (you can get access to these from the entity designer's Write Code drop down) to set the DateTime value while on the server.

    Justin Anderson, LightSwitch Development Team

    • Marked as answer by H. ALFADL Saturday, June 8, 2013 11:22 PM
    Saturday, June 8, 2013 8:41 PM
    Moderator
  • Thanks Justin :)
    Saturday, June 8, 2013 11:23 PM