文件更新失败 [英] update fails for a file

查看:58
本文介绍了文件更新失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我正在处理上传文件的应用程序,如果文件已经存在于数据库中,那么它会将信息更新(重写)到数据库中。



当我调试时,我发现更新值失败了。和transactin回滚

请任何人都可以提供帮助。

Hi

I am working on an application of uploading files and if the file already exists in the database then it updates(rewrites) the information into the database.

When I debugged I found that while updating the values fails. and transactin is rolled back
Please any one can help.

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER Procedure [dbo].[IMS_NB_EMRUP_Process_Update]
	@LogGuid uniqueidentifier, 
	@FileGuid uniqueidentifier, 
	@Clients int, 
	@Completed int, 
	@Prepared int, 
	@DateTime datetime, 
	@UploadedByIMSUserId char(25),
	@StartTime datetime,
	@FileName nvarchar(250)
AS


update IMS_eMRUpload_Process SET 
					Clients=@Clients, 
					Completed=@Completed, 
					Prepared=@Prepared, 
					DateTime=@DateTime,
					UploadedByIMSUserId=@UploadedByIMSUserId,
					StartTime=@StartTime,
					FileName=@FileName
					

		where LogGuid=@LogGuid and FileGuid=@FileGuid

推荐答案

我假设你的意思是鉴于您没有在该代码中显示任何事务处理,您的代码会抛出ApplicationException而不是实际回滚,因此术语回滚不适用。



如果是这样,那么最有可能的是你的消息说:在数据库中找不到LogId和FileId组合,所以没有进行更新。

使用调试器检查您通过 _logGuid _fileGuid 传递的值,或者将它们打印到某处的日志文件中,然后检查您的数据库是否匹配数据。我只能假设其中一个或另一个不是你想象的那样。
I'm assuming that you mean that your code throws the ApplicationException, rather than actually rolls back, given that you aren't showing any transaction processing in that code, so the term "rollback" is not applicable.

If so, then the most likely thing is as your message says: the LogId and FileId combination has not been found in the database, so no update was performed.
Either use the debugger to check the values you are passing through as _logGuid and _fileGuid or print them to a log file somewhere, then check your DB for matching data. I can only assume that one or other of them is not what you think it is.


这篇关于文件更新失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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