页面刷新重复记录 [英] Duplicate record on page refresh

查看:74
本文介绍了页面刷新重复记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在做一个网络项目.在我的项目中,我通过按钮Submit将数据插入db.完成按钮单击操作后,如果刷新页面,则会在db中存储重复的记录.

Hi
I am working on a web project. In my project, I am inserting data into db through button submit. After completion of button click action, if I refresh my page, a duplicate record gets stored in db.

How to prevent duplicate data insert, if i click on refresh?

推荐答案

看看这些文章是否存在类似问题:
ASP.Net中的刷新页面问题 [提交请求后,请刷新 [
Have a look at these articles for similar issue:
Refresh Page Issue in ASP.Net[^]
Stop Refresh after Submitting your Request[^]


有很多方法可以检查页面是否刷新.

您应该使数据库/存储过程更强大,以防止任何不必要的或重复的输入.由于您对UI/客户端没有太多控制权.[尽管有很多方法:)].

因此,只需在数据库中放置一些条件,例如,如果输入数据已可用,则只需返回o状态并通知用户数据已可用.

最重要的是,发布的解决方案非常好,您也可以从中获得一些想法.
There are many ways to check the page is refreshed or not.

You should make the database/store procedure strong to prevent any unnecessary or duplicate entry. As you don''t have that much control over UI/client side.[Although there are many ways :) ].

So just place some condition in the database like, if the incoming data is already available then just return o status and inform user that data is already available.

Above all posted solutions are very good and you can also get some idea from it.


您好,

您可以做的一件事简单.

采取步骤,然后将插入代码写入该步骤.
还放置带有记录的if条件.

如果记录存在,则该记录的返回消息存在.否则插入一个值.
Hi,

One simple thing you can do.

Take procedure and write your insert code into that procedure.
Also put a if condition with record exists.

If record exists that return message that record exists. Else insert a value.


这篇关于页面刷新重复记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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