且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将数据从.dat文件导入到MVC中的SQL Server中

更新时间:2023-01-21 13:58:53

这将给出你一般的想法。根据您的描述,您的文件不是CSV,而是以制表符分隔。



Link

My requirement is I want to browse the file with extension .DAT(test.DAT) file in my MVC4 application, where the user can select the file. There is a Same columns in both my database table as well as in the .DAT(test.DAT) file. Before importing the data in the table of the database the Columns present in the .DAT(test.DAT) file should be compared with the Columns in the database.
1)Selecting The .DAT(test.DAT)file with data Columns and Rows same as Table designed in .DAT(test.DAT) file rows and Columns.
2)All rows and Columns like in .DAT(test.DAT) file Table also designed with same fromat in SQL Server Database in a same format.

3)When I upload this .DAT file file i need to Save the .DAT file data into Data base tables same as in .DAT file Using MVC4

This is data of .DAT file
test.dat file data
1 528 Q25E test2 10-02-13 10.5789
2 587 Q26F Adta 11-05-14 14.25789

Should Be save in database like this
Table designed like this
Id EmpID Code Name Date Amount
1 528 Q25E test2 10-02-13 10.5789
2 587 Q26F Adta 11-05-14 14.25789

This will give you a general idea. From your description your file is not CSV but tab delimited.

Link