Best Practices for uploading files to database(将文件上传到数据库的最佳实践)
问题描述
我正在寻找有关如何从 .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.
这篇关于将文件上传到数据库的最佳实践的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:将文件上传到数据库的最佳实践
基础教程推荐
- 重新排序 WPF TabControl 中的选项卡 2022-01-01
- 从 C# 控制相机设备 2022-01-01
- 将数据集转换为列表 2022-01-01
- SonarQube C# 分析失败“不是指针的有效行偏移" 2022-01-01
- Mono https webrequest 失败并显示“身份验证或解密失败" 2022-01-01
- 在 VB6 或经典 ASP 中使用 .NET 2022-01-01
- 更新 Visual Studio 中的 DataSet 结构以匹配新的 SQL 数据库结构 2022-01-01
- 如果条件可以为空 2022-01-01
- C# 9 新特性——record的相关总结 2023-04-03
- 获取C#保存对话框的文件路径 2022-01-01
