如果第一个用户正在保存数据,则向第二个用户显示消息 [英] Displaying message to second user if first user is in process of saving the data

查看:79
本文介绍了如果第一个用户正在保存数据,则向第二个用户显示消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当第一个用户保存数据时,我想向第二个用户显示消息

我想对保存按钮进行编码,以便如果有任何用户正在保存数据,则第二个用户会收到有人正在处理的通知.


请帮忙....

I want to show a msg to second user when the first user is saving the data

i want to code on save button so that if any user is saving the data then the second user get notification that someone processing.


please help....

推荐答案

我要做接下来的事情.
在数据库的表中,我有一个唯一的ID和一个名为lastmodified的日期时间字段. 从数据库检索数据时,两个字段都存储在数据集或数据表对象中
保存数据时,两个字段都作为sqlparameters添加到更新查询中.我首先检查lastmodified字段是否保持不变.如果未更改,则完成更新,并使用数据库中的GetDate()值更新lastmodified.更新的行数大于0(ExecuteNonQuery结果)
当第二个用户尝试更新数据时,您可以
-在存储过程中引发错误,该错误将在dotnet程序中收到.
-得出结论ExecuteNonQuery的结果为0,并从数据库向用户显示新值.
I do the next things.
In the table in the database I have a unique ID and a datetime field called lastmodified.
When retrieving the data from the database both fields are stored in the dataset or datatable object
When saving data both fields are added to the update query as sqlparameters. I first check if the lastmodified field is unchanged. If that is not changed the update is done and lastmodified is updated with the GetDate() value in the database. The number of rows updated is larger than 0 (ExecuteNonQuery result)
When the second user tries to update the data you can
- throw an error in your stored procedure which will be received in the dotnet program.
- conclude that the ExecuteNonQuery result was 0 and show the new value(s) from the database to the user.


这篇关于如果第一个用户正在保存数据,则向第二个用户显示消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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