使用文本文件填充数据集 [英] Populating a dataset using text files

查看:110
本文介绍了使用文本文件填充数据集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找从文本文件中的数据填充数据集。数据由新行分隔。有没有人有想要提供信息的经验或信息,请告诉我!!!!!!!

总的来说,我要将信息导入MS Access数据库。如果有人有更好/更容易的方法来实现这一目标,我会非常感激。

提前致谢!!!!!!

推荐答案

那么,您的SIG是否意味着您拥有信息技术学位或者您正在攻读研究生学位?

您可以从根本上采取两种方法。首先,您可以编写自己的数据处理程序,使用(适当的语言)Read语句来读取和解析Text文件中的数据。这在Visual Basic中很容易实现 - 在C#或其他更新的语言中更难。

There are fundamentally two approaches you can take. First, you can write your own data handler that uses (language appropriate) Read statements to read and parse the data from the Text file. This is really easy to do in Visual Basic--harder in C# or other newer languages.

接下来,您可以使用ODBC Text Data Source驱动程序方法。在这里,您构建一个解决文件的DSN,选择解析选项(我希望列用逗号,制表符,引号或特殊字符分隔),以及如何处理行。在这种情况下,您可以使用ADO或ADO.NET打开TextFile并将行输入到合适的Recordset或DataTable中,或者只是构建将行发布到JET数据库的INSERT语句。

Next, you can use the ODBC Text Data Source driver approach. Here you build a DSN that addresses the file, chooses the parsing options (I hope the columns are delimited with commas, tabs, quotes or a special character), and how the rows are to be handled. In this case you can use ADO or ADO.NET to open the TextFile and input the rows into a suitable Recordset or DataTable or simply build INSERT statements that post the rows to the JET database.

您可能还会调查可以为您执行此操作的SSIS / DTS / BulkCopy。

You might also investigate SSIS/DTS/BulkCopy which can do this for you.

hth


这篇关于使用文本文件填充数据集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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