How do I select getdate () from subsonic?

I am using Subsonic 2, SQL Server 2005.

This is how I update the intro_accepted column of the Member table record.

member.Showintro = true;
member.IntroAcceptby = AdminUser.Username;
member.IntroAccepted = DateTime.Now; // but I wan't getdate() from SQL Server
member.Save();

      

What's the easiest way to select getdate () from the database and put it in the intro_accepted column?

+2


source to share


1 answer


  • Set the IntroAccepted column in your DB to allow null and give it the default GetDate.

  • Rebuild your model and SubSonic will make the IntroAccepted property null.

  • Don't specify the IntroAccepted value (leave it null) in your code, and when you call Save SQL, you find that there is no value for IntroAccepted and use GetDate to fill it in.

-



member.Showintro = true;
member.IntroAcceptby = AdminUser.Username;
member.IntroAccepted = null; // You don't actually need to do this as a nullable date will be null by default
member.Save();

      

0


source







All Articles