CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Logical Delete (ASP)

Print topic Send  topic

Author Message
Brian Mann
Posted: 01/13/2002, 5:04 AM

Have posted this to newsgroup but just in case someone can help a new CC user:

I wanted to implement a logical delete function that worked off the DELETE
button that CC would generate on any given page. That is, instead of
physically deleting the record I want CC to update a deleted_datetime and
deleted_by fields which I have on all my tables. Should I be using "Custom
Action" and how can I prevent/override the normal delete function.

* Note: deleted_datetime should be date & time that the delete button was
pressed and deleted_by should contain the user login name of whoever is
logged on.

Thanks
Brian

Ken Hardwick
Posted: 01/13/2002, 5:47 AM

Brian,
You can create your own sql to be executed when "delete" is clicked.
To do so, set the value of "sSQL" in the "Before Delete" event.
Something like..

sSQL = "Update YourTableNuame set "
sSQL = sSQL & "[deleted_datetime] = " & now()
sSQL = sSQL & ",[deleted_by] = " & toSQL(Session("userid"),"TEXT")
sSQL = sSQL & " where " & swhere

Note: If you will review the ASP code as generated by CC, that before CC creates the value for "sSQL", it checks to see if it is blank..if it is not
blank, then it does not create the value...for instance, see the code below


if sSQL = "" then
sSQL = "delete from Members where " & sWhere
end if

So, if you create a value for sSQL before this, then your sSQL is used as you created in the "before" event. Pretty cool/smart by the CC programers...

Ken Hardwick
www.kenhardwick.com
Norman,Ok


   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.