导入.txt文件 [英] Importing .txt file

查看:64
本文介绍了导入.txt文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个.txt已经从外部源导出为.csv。

我需要做的是将它导入SQL2000(进入表格)但我需要

对数据做了特殊的事情:


1.我需要查找前三个字符并将行导入单独的

表。例如。如果前三个字符以CCC开头,那么这一行将进入CCC_table,如果它是TTT然后进入TTT_table等......

2.一旦我有我建立了表格,我需要在

表格中添加更多列,例如AAA,BBB,CCC并对数据进行查找和替换。例如。在

表CCC_table中,如果第二行包含AAA,那么我需要输出这个到
的AAA字段。


请有人帮我这个。我是VB.net和Visual的新手。整个上都是
Studio.net,但我会很感激。


谢谢,


skc

I have a .txt which has been exported as a .csv from an external source.
What i need to do is to import this into SQL2000 (into a table) but I need to
do special things on the data:

1. I need to look for the first three chars and import rows into separate
tables. E.g. if the first three chars begin with CCC, then this row goes
into the CCC_table, if it is TTT then into the TTT_table etc...
2. Once I have my tables built up, I need to do add more columns onto the
table, e.g. AAA, BBB, CCC and do a find and replace on the data. E.g. in
table CCC_table, if the 2nd row contains a AAA, then I need to output this to
the AAA field.

Please can someone help me on this. I am new to VB.net and Visual
Studio.net as a whole, but would appreciate some pointers.

Thanks,

skc

推荐答案

Skc,


这是一个经常被问到的答案并填写在这些

新闻组中有大量答案。

下次这类问题的最佳新闻组。


microsoft .public.dotnet.framework.adonet

microsoft.public.dotnet.languages.vb


http://www.windowsformsdatagridhelp....f212f9e0de193


另一种方式也在我们的网站上。


我希望这有帮助


Cor


" Skc" < Sk*@discussions.microsoft.com> schreef in bericht

news:56 ********************************** @ microsof t.com ...
Skc,

This is an often asked answer and filled with tons of answers in these
newsgroups.
The best newsgroups for this kind of questions are the next time.

microsoft.public.dotnet.framework.adonet
microsoft.public.dotnet.languages.vb

However, we have as well a sample for this on our website.

http://www.windowsformsdatagridhelp....f-212f9e0de193

The other way around is as well on our site.

I hope this helps

Cor

"Skc" <Sk*@discussions.microsoft.com> schreef in bericht
news:56**********************************@microsof t.com...
我有一个.txt,它已经从外部源导出为.csv。
我需要做的是将它导入SQL2000(进入一个表)但我需要
来对数据做特殊的事情:

1.我需要查找前三个字符并将行导入单独的
表。例如。如果前三个字符以CCC开头,则此行进入CCC_table,如果是TTT,则进入TTT_table等......
2.一旦我建立了表格,我需要在
表格中添加更多列,例如AAA,BBB,CCC并对数据进行查找和替换。例如。在表CCC_table中,如果第二行包含AAA,那么我需要输出这个
到AAA字段。

有人可以帮我这个。我是VB.net和Visual
Studio.net的新手,但我会很感激一些指示。

谢谢,

skc
I have a .txt which has been exported as a .csv from an external source.
What i need to do is to import this into SQL2000 (into a table) but I need
to
do special things on the data:

1. I need to look for the first three chars and import rows into separate
tables. E.g. if the first three chars begin with CCC, then this row goes
into the CCC_table, if it is TTT then into the TTT_table etc...
2. Once I have my tables built up, I need to do add more columns onto the
table, e.g. AAA, BBB, CCC and do a find and replace on the data. E.g. in
table CCC_table, if the 2nd row contains a AAA, then I need to output this
to
the AAA field.

Please can someone help me on this. I am new to VB.net and Visual
Studio.net as a whole, but would appreciate some pointers.

Thanks,

skc



我不明白 - 请你详细说明。


" Cor Ligthert [MVP]"写道:
I don''t understand - please can you elaborate.

"Cor Ligthert [MVP]" wrote:
Skc,

这是一个经常被问到的答案,在这些
新闻组中充满了大量的答案。
最好的这类问题的新闻组是下一次。

microsoft.public.dotnet.framework.adonet
microsoft.public.dotnet.languages.vb

然而,我们在网站上也有一个样本。

http://www.windowsformsdatagridhelp....f212f9e0de193

另一种方式也在我们的网站上。

我希望这有帮助

Cor

Skc < Sk*@discussions.microsoft.com> schreef在bericht
新闻:56 ********************************** @ microsof t.com。 ..
Skc,

This is an often asked answer and filled with tons of answers in these
newsgroups.
The best newsgroups for this kind of questions are the next time.

microsoft.public.dotnet.framework.adonet
microsoft.public.dotnet.languages.vb

However, we have as well a sample for this on our website.

http://www.windowsformsdatagridhelp....f-212f9e0de193

The other way around is as well on our site.

I hope this helps

Cor

"Skc" <Sk*@discussions.microsoft.com> schreef in bericht
news:56**********************************@microsof t.com...
我有一个.txt,它已经从外部源导出为.csv。
我需要做的是将它导入SQL2000(进入表格)但是我需要
对数据做特殊的事情:

1.我需要查找前三个字符并将行导入单独的
表。例如。如果前三个字符以CCC开头,则此行进入CCC_table,如果是TTT,则进入TTT_table等......
2.一旦我建立了表格,我需要在
表格中添加更多列,例如AAA,BBB,CCC并对数据进行查找和替换。例如。在表CCC_table中,如果第二行包含AAA,那么我需要输出这个
到AAA字段。

有人可以帮我这个。我是VB.net和Visual
Studio.net的新手,但我会很感激一些指示。

谢谢,

skc
I have a .txt which has been exported as a .csv from an external source.
What i need to do is to import this into SQL2000 (into a table) but I need
to
do special things on the data:

1. I need to look for the first three chars and import rows into separate
tables. E.g. if the first three chars begin with CCC, then this row goes
into the CCC_table, if it is TTT then into the TTT_table etc...
2. Once I have my tables built up, I need to do add more columns onto the
table, e.g. AAA, BBB, CCC and do a find and replace on the data. E.g. in
table CCC_table, if the 2nd row contains a AAA, then I need to output this
to
the AAA field.

Please can someone help me on this. I am new to VB.net and Visual
Studio.net as a whole, but would appreciate some pointers.

Thanks,

skc




D>我不明白 - 请你详细说明。
D>I don''t understand - please can you elaborate.



你不明白的是什么,你试过样品吗?


这样你得到一个数据表,你可以处理所有的列<分别为



Cor


What is it that you don''t understand, did you try the sample?

In that way you get a datatable wherein you can handle all the columns
separately.

Cor


这篇关于导入.txt文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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