問題描述
我正在尋找有關如何從 .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.
這篇關于將文件上傳到數據庫的最佳實踐的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!