将.csv文件写入SQL Server的.net方法 [英] .net method that writes .csv file to SQL Server
本文介绍了将.csv文件写入SQL Server的.net方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想创建一个vb.net程序,从指定的
目录中打开.csv文件,然后将该文件加载到位于
远程服务器上的SQL服务器表。有人可以指向我这样做的代码示例吗?
我可以将其设置为在Windows 2000服务器上的指定时间运行,以及如何使用
我这样做。我熟悉XP中的任务计划,但不知道在2000服务器中这相当于这个的价值是多少。
谢谢!
Hi,
I want to create a vb.net procedure that opens a .csv file from a specified
directory and then load that file into a SQL server table located on a
remote server. Can someone point me towards a code sample that does this?
Can I set this up to run at a specified time on windows 2000 server, and how
do I do this. I"m familiar with task schedular in XP but don''t know what the
equivalent of this is in 2000 server.
Thanks!
推荐答案
为什么要使用除sql server之外的任何东西呢?您可以使用dts或其他
等效方法让sql server定期导入文件的数据。
" Rasta" < AB ***** @ netgate.net>在消息中写道
news:em ************** @ TK2MSFTNGP14.phx.gbl ...
|
|
|我想创建一个vb.net程序,从指定的
打开.csv文件
|目录然后将该文件加载到位于
|的SQL服务器表中远程服务器。有人能指出我这样做的代码示例吗?
|我可以将其设置为在Windows 2000服务器上的指定时间运行,并且
如何
|我这样做我熟悉XP中的任务计划,但不知道是什么
|相当于2000服务器。
|
|谢谢!
|
|
why use anything other than sql server for this? you can use dts or other
equivalent method to have sql server routinely import the file''s data.
"Rasta" <ab*****@netgate.net> wrote in message
news:em**************@TK2MSFTNGP14.phx.gbl...
| Hi,
|
| I want to create a vb.net procedure that opens a .csv file from a
specified
| directory and then load that file into a SQL server table located on a
| remote server. Can someone point me towards a code sample that does this?
| Can I set this up to run at a specified time on windows 2000 server, and
how
| do I do this. I"m familiar with task schedular in XP but don''t know what
the
| equivalent of this is in 2000 server.
|
| Thanks!
|
|
我需要对csv文件中的每条记录进行深入验证
上传到SQL之前。这个,以及其他原因是为什么我使用.net。
我正在寻找循环通过csv文件的代码示例然后
将它附加到SQL表
谢谢
"?" < a@b.com>在消息新闻中写道:Ji ***************** @ fe02.lga ...
I need to do in-depth validation of each record in the csv file before
upload to SQL. This, among other reasons is why I am using .net.
I"m looking for a code sample that loops through the csv file and then
appends it to SQL tables
thanks
"" <a@b.com> wrote in message news:Ji*****************@fe02.lga...
为什么要使用sql server以外的任何东西呢?您可以使用dts或其他等效方法让sql server定期导入文件的数据。
" Rasta" < AB ***** @ netgate.net>在消息中写道
新闻:em ************** @ TK2MSFTNGP14.phx.gbl ...
|
|
|我想创建一个vb.net程序,打开
指定的.csv文件目录然后将该文件加载到位于
|上的SQL Server表中远程服务器。有人能指出我的代码示例吗?
|我可以将其设置为在Windows 2000服务器上的指定时间运行,并且
如何
|我这样做我熟悉XP中的任务调度,但不知道是什么
相当于2000服务器。
|
|谢谢!
|
|
why use anything other than sql server for this? you can use dts or other
equivalent method to have sql server routinely import the file''s data.
"Rasta" <ab*****@netgate.net> wrote in message
news:em**************@TK2MSFTNGP14.phx.gbl...
| Hi,
|
| I want to create a vb.net procedure that opens a .csv file from a
specified
| directory and then load that file into a SQL server table located on a
| remote server. Can someone point me towards a code sample that does
this?
| Can I set this up to run at a specified time on windows 2000 server, and
how
| do I do this. I"m familiar with task schedular in XP but don''t know what
the
| equivalent of this is in 2000 server.
|
| Thanks!
|
|
here''sac#snip:
Regex r = new Regex(&,;(?=([^ \"] *" [^"] *")*(?![^] *")) ");
string s =" \" a",b," c,d,e",f";
int start = 0;
foreach(匹配m.r.Matches(s))
{
Console.WriteLine(s.Substring(start,m) .Index - start));
start = m.Index + 1;
}
Console.WriteLine(s.Substring(start, s.Length - 开始));
轻松转换,实现干净,快速,高效的编码。
hth,
me
here''s a c# snip:
Regex r = new Regex(",(?=([^\"]*"[^"]*")*(?![^"]*"))");
string s = "\"a",b,"c, d, e",,f";
int start = 0;
foreach (Match m in r.Matches(s))
{
Console.WriteLine(s.Substring(start, m.Index - start));
start = m.Index + 1;
}
Console.WriteLine(s.Substring(start, s.Length - start));
converts easily and makes for clean, fast, efficient coding.
hth,
me
这篇关于将.csv文件写入SQL Server的.net方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文