如何在浏览器直接关闭时从数据库中删除数据? [英] How to delete data from database when browser is directly closed?

查看:184
本文介绍了如何在浏览器直接关闭时从数据库中删除数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在浏览器直接关闭时从数据库中删除数据.....



我尝试过:



我有一个数据库名称register.mdf它包含一个表ONDETAIL我使用session插入用户名,我也在注销按钮中编写删除命令事件...它显然正在工作......但问题是如果你直接关闭浏览器然后它不是从数据库删除...请帮助.... 

解决方案

您可以在要删除的日期添加到期日期。然后你有一个定期过程(分钟;小时;天数......在购物车的情况下)假定用户已经注销(或过期),并删除现在陈旧的会话数据。 / BLOCKQUOTE>

I want delete the data from database when browser directly close.....

What I have tried:

i have a database name register.mdf its contain a table ONDETAIL i insert the username with using session and i also write the delete command in logout button click event...it is clearly working...but the problem is if you close the browser directly then it is not delete from database...please help....

解决方案

You add an "expiry date" to the date that you want deleted. Then you have a "periodic" process (minutes; hours; days ... in the case of a "shopping cart") that "assumes" the user has logged out (or expired), and deletes the now stale session data.


这篇关于如何在浏览器直接关闭时从数据库中删除数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆