在SQL Server中安全更改数据 [英] Safe changing data in SQL server

查看:76
本文介绍了在SQL Server中安全更改数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尊敬的先生,
我在VB.net中有一个程序可以清空并更改表,如下所示:

dear sirs,
I have a procedure in VB.net that empty and changes a table as this :

.
sqlcmd="delete from mytable"
''excute sql...
.
while ...
.
.
sqlcmd="insert into mytable ..."
''excute sql...
.
end while
.


问)我检查安全性;如果在循环过程中发生了错误(错误,局域网连接失败,硬件中断),则我的表不可用.我应该使用什么套头衫?

谢谢,


Q) i check for safety; if during loop a prablem happend (error,lan connecttion fail ,hardware braekdown) my table is not useable. What sloution should i use ?

Thanks,

推荐答案



您应该在这里使用交易.如果您使用事务处理,则在这种情况下将为您提供帮助.请在这里阅读,

http://www.sql-server-performance.com/articles/asp_ado/ado_transactions_p1.aspx


http://www.codeproject.com/KB/database/transactions.aspx
Hi,

You should use Transaction here. If you use Transaction help you in this scenario. Please read here,

http://www.sql-server-performance.com/articles/asp_ado/ado_transactions_p1.aspx


http://www.codeproject.com/KB/database/transactions.aspx


这篇关于在SQL Server中安全更改数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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