如何将数据从.dat文件导入到MVC中的SQL Server中 [英] How to import data from .dat file into SQL Server in MVC

查看:130
本文介绍了如何将数据从.dat文件导入到MVC中的SQL Server中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的要求是我想在我的MVC4应用程序中使用扩展名.DAT(test.DAT)文件浏览该文件,用户可以在该文件中选择该文件。我的数据库表和.DAT(test.DAT)文件中都有相同的列。在导入数据库表中的数据之前,应将.DAT(test.DAT)文件中存在的列与数据库中的列进行比较。

1)选择.DAT(测试。 DAT)文件的数据列和行与.DAT(test.DAT)文件行和列中设计的表相同。

2).DAT(test.DAT)文件中的所有行和列表同样在SQL Server数据库中以相同的格式设计了相同的文件。



3)当我上传这个.DAT文件文件时,我需要将.DAT文件数据保存到与.DAT文件相同的数据库表使用MVC4



这是.DAT文件的数据

test.dat文件数据
1 528 Q25E test2 10-02-13 10.5789

2 587 Q26F Adta 11-05-14 14.25789



应该像这样保存在数据库中

像这样设计的表

Id EmpID代码名称日期金额

1 528 Q25E test2 10-02-13 10.5789

2 587 Q26F Adta 11-05-14 14.25789



解决方案

这将给出你一般的想法。根据您的描述,您的文件不是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


这篇关于如何将数据从.dat文件导入到MVC中的SQL Server中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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