在将信息保存到数据库之前检查 [英] Check before saving the information to db

查看:52
本文介绍了在将信息保存到数据库之前检查的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨......

我想知道如何在将信息保存到数据库之前检查用户是否修改了文本.

Hi......

I want to know how I can check if a user has modified the text or not before I save the information in the database.

推荐答案

非常麻烦地回答您的问题不要给我们任何具体信息.这取决于文本的显示和/或输入方式.

如果您在TextBox中显示文本并让用户在其中进行更改,则很简单.

将原始文本保存在字符串变量中,然后在保存之前将字符串变量与文本框的文本进行比较

Very har to answer seing that you don''t give us any specific information. It depends on how the text is displayed and/or entered.

If you show the text in a TextBox and let the user change it there, it''s simple.

Save the original text in a string variable and compare the string variable to the textbox'' text before saving

If Textbox1.Text <> theValueToBeginWith Then
   ''Save the text
Else
   ''Don''t bother
End If


似乎您正在寻找数据库记录的乐观锁定.
检查一下.

http://www.blackwasp.co.uk/OptimisticLocking.aspx [
It seems that you are looking for Optimistic locking of database records.

Check this.

http://www.blackwasp.co.uk/OptimisticLocking.aspx[^]


您应提供有关自己所用内容的更多信息想做.

您想做的(我认为)要做的事情涉及两个变量:
1.包含原始值.
2.保存时包含值.

保存时,将两者进行比较,看看它们是否不同.成功完成保存后,用您刚刚保存的值更新原始值.

如果这不能回答您的问题,请更具体一些.

希望对您有所帮助.
You should provide more information on what you want to do.

The bottom line to what (I think) you want do to involves two variables:
1. Containing the original value.
2. Containing the value when saving.

When saving you compare the two and see if they are different. After the save has been completed succesfully, update the original value with the value you just saved.

If this does not answer your question, be a little more specific.

hope this helps.


这篇关于在将信息保存到数据库之前检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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