将文件上传到数据库的最佳实践 [英] Best Practices for uploading files to database

查看:25
本文介绍了将文件上传到数据库的最佳实践的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找有关如何从 .NET Web 应用程序创建与数据库的接口以从 Excel 文件上传数据的任何最佳实践或想法我应该使用允许加载所有记录并标记错误的机制,还是应该使用在发生错误时停止加载的机制.

I am looking for any best practices or ideas on how you would create an interface with a DB from a .NET web application to upload data from Excel files Should I use a mechanism that allows all the records to be loaded and flags the errors or should I use a mechanism that stops the load when an error occurs.

我以前从来没有处理过这种类型的要求,所以任何帮助都会非常棒!

I've never had to deal with this type of requirement before so any help would be super!

谢谢

推荐答案

如果您的数据库中的数据完整性很重要,请不要导入有错误或不符合数据库验证要求的数据.

If data integrity in your DB is important, do not allow data to be imported that has errors or does not meet the validation requirements of your DB.

由于这些是 Excel 文件,用户应该很容易更正 Excel 文件中的数据,而不是尝试使用其他界面来修复数据.只需确保错误消息将用户引导至问题所在的字段并清楚地解释问题所在.

Since these are Excel files, it should be easy enough for the user to correct the data in the Excel file, instead of trying to use another interface to fix the data. Just make sure the error messages direct the user to what field is the problem and clearly explain what is wrong.

这篇关于将文件上传到数据库的最佳实践的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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