English 中文(简体)
如何了解我的询问是否有错误,或者没有改变数据库中的真实数据?
原标题:How to know my query has an error or not without changing the real data in database?

我需要建立一种制度,检查我的最新询问是否错误,或者数据库中的任何行文是否有可能改动?

我正在使用C# asp.net和服务器2008年。

问题回答
  1. Start a transaction
  2. Run your statement
  3. Check for errors
  4. Rollback your transaction

not sure I understood your question, so I guess...

我将在一项交易中执行指挥,而不是执行,以便在出现以下错误时执行该守则:<代码>command.ExecuteNon Query()将放弃该例外,无论如何,在<代码>transaction.RollBack()将防止数据库中出现任何变化。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签