Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
chapm4
Yak Posting Veteran
58 Posts |
Posted - 2011-10-05 : 14:05:22
|
| I realize this is probably not the exact place for this, but if someone can steer me correctly I would appreciate it.Have an asp page that user selects a week from date picker and it returns data from sql table in a series of checkboxes for overtime availability.ie for the week of 10/10/2011 the checkboxes are Monday through Sunday, the user clicks the checkboxes they want to work overtime and hits a submit button. Let's assume they chose Monday and Wednesday. If they go back to this page later and pick the week of 10/10/2011 the sql table shows checked in the Monday and Wednesday checkboxes. They can then make any changes they want, hit the submit button, and that sql record is updated with the new data.So on to the issue........For audit purposes, there is another sql table called ot_audit. What I want to do is every time one of the checkboxes is changed (pre hitting the submit button), I need a new record added to the ot_audit table. It will show a datetime stamp, who made the change, what was clicked, and if it was checked or unchecked.Question is....how in the heck do I do this? I'm new here and all I know is there are onChange and onClick events. Lost after that. Please help me.Reply With Quote |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-10-06 : 01:07:04
|
| you need to write code in your front end language for OnClick event for submit button. In that pass values for checkboxes(check for checked status). so for checked ones it will get value of 1. then call a sql procedure to pass the values. I assume you should have a table set up in sql which will have date and day patterns(monday till sunday) and will indicate which of them are set or not. the sql procedure will be inserting into this created table. You need to add a update trigger on this table and check for difference of patterns between magic tables INSERTED and DELETED to identify changed records. Then insert into audit table values from INSERTED and DELETED to get old and new values. for getting user details you can use SUSER_SNAME() and for getting date use GETDATE()------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
chapm4
Yak Posting Veteran
58 Posts |
Posted - 2011-10-06 : 11:11:33
|
| Thanks that helps a lot. |
 |
|
|
|
|
|