Solved

Edit date in edit view asp.net mvc

Posted on 2011-03-01
3
477 Views
Last Modified: 2012-05-11
Hi,

I am using Linq to Sql. I am inserting data in the table using create view. Date column have default value = getdate() in the sql server database. So automatically, it will insert the server date.

But problem is, when I update the data using edit view and save view , it will not update the date in the table.

How to update the date on every insert in asp.net mvc.

Thanks
0
Comment
Question by:Saroj13
  • 2
3 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 35016614
You may find it's easier to implement that as a trigger on the database table rather than trying to do it through your app.
0
 

Author Comment

by:Saroj13
ID: 35019878
How to do that on the database table?
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 35020132
Something like the following should do:
CREATE TRIGGER trgUpdateDate
ON YourTable
AFTER INSERT, UPDATE
AS
     UPDATE YourTable SET YourDateColumn = GETDATE()
           WHERE YourTable.YourKeyField = Inserted.YourKeyField

Open in new window

0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now