为什么重复数据库数据 [英] Why in Database data repeated

查看:75
本文介绍了为什么重复数据库数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我正在使用Telerik Winform c#。



当我这样做时,我的表格会出现问题。像按钮点击一样的操作然后重复数据库的数据,因为我点击了我的按钮多少次。



为什么我会遇到这种情况。



一旦我从数据库中删除了重复的数据。



但是又一次发生了。



所以任何人都可以告诉我为什么会发生这种情况以及解决方案是什么。



谢谢。

Hello,
I am work on Telerik Winform c#.

I have face issue as that on my win form when i do an action like button click then the data of database are repeated as how many time i click on my button.

why i face this situation.

once i delete the repeated data from database as well.

But again it was happened.

so plz can anyone tell me that why this happen and what will be the solution for that.

Thanks.

推荐答案

这取决于您在按钮中执行的操作。例如,如果您在按钮代码中插入数据,则会发现您在数据库中没有正确的密钥,并检查应用程序是否注意到您正在生成重复数据。在这种情况下,您将反复插入相同的行。要防止重复数据,请使用主键或唯一键等约束。有关详细信息,请参阅 http://en.wikipedia.org/wiki/Unique_key [ ^ ]



如果你是获取数据然后您可能在查询中遇到问题,例如缺少连接,这会导致WHERE子句中的交叉连接或其他缺少定义。
It depends on what action you're doing in the button. For example if you're inserting data within the button code then it sounds that you don't have proper keys in the database and checks in the application to notice that you're generating a duplicate data. In such case you would insert the same row over and over again. To prevent duplicate data, use constraints such as primary key or unique key. For more info, see http://en.wikipedia.org/wiki/Unique_key[^]

If you're fetching data then you probable have a problem in the query like a missing join which would cause a cross join or other missing definitions in the WHERE clause.


您好,



这里点击按钮,您一次又一次地提出请求。相反,您应该在数据库级别保留一些重复的记录检查并限制数据的重复输入,确保单击按钮并将数据输入数据库之后,应重置控件以避免重复输入。或者你可以限制按钮在处理一个请求时多次点击。



谢谢

Sisir Patro
Hi,

Here by clicking the button you are making the request again and again. Instead you should keep some duplicate record check at the database level and restrict the duplicate entry of your data, make sure that once the button is clicked and the data is entered into the database al the controls should be reset to avoid duplicate entry. Or you can restrict the button to click multiple times while one request is processing.

Thanks
Sisir Patro


这篇关于为什么重复数据库数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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