By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,467 Members | 1,308 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,467 IT Pros & Developers. It's quick & easy.

How do you move a comma delimited text file with 3 fields into a SQL 2000 table

P: n/a

Hello All,

I have a comma delimited text file, which I would like to move into a
SQL 2000 table . I created a DTS package in SQL Server and saved it as a
VB.bas . I am writting the code in C# and I though that I might be able
to change a few lines and keep the bulk of the code. However , it seems
that there is a pretty big change in how VB is written and how C#.net is
written. Does anyone have an example of using DTS and C# to move a few
hundred records into a SQL Server table?

Thank You in Advance for Your Help,
Ken
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi Kenneth,

Are you going to do this more than once? if not just use the DTS of the SQL
server and that's all
if y ou are planning doing it more than once then I think that it's better
if you do it all in code, something like this:

open file
open DB connection
while ( line=file.ReadLine()!=null )
{
string[] fields = line.Split( new char {','} );
CreateSQL Command
Execute SQL Command
}
close DB connection
close file

I think that it's the best solution in your case

Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Kenneth Koski" <kk*****@mindspring.com> wrote in message
news:ul**************@TK2MSFTNGP10.phx.gbl...

Hello All,

I have a comma delimited text file, which I would like to move into a
SQL 2000 table . I created a DTS package in SQL Server and saved it as a
VB.bas . I am writting the code in C# and I though that I might be able
to change a few lines and keep the bulk of the code. However , it seems
that there is a pretty big change in how VB is written and how C#.net is
written. Does anyone have an example of using DTS and C# to move a few
hundred records into a SQL Server table?

Thank You in Advance for Your Help,
Ken
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 15 '05 #2

P: n/a

Hi Kenneth,

There is a book talked about how to use Sql Server 2000 DTS in .Net
environment with C#, you can download it from the the link below:
http://www.sqldev.net/dts/DotNETCookBook.htm

Hope this helps,
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: Kenneth Koski <kk*****@mindspring.com>
| X-Newsreader: AspNNTP 1.50 (ActionJackson.com)
| Subject: How do you move a comma delimited text file with 3 fields into a
SQL 2000 table
| Mime-Version: 1.0
| Content-Type: text/plain; charset="us-ascii"
| Content-Transfer-Encoding: 7bit
| Message-ID: <ul**************@TK2MSFTNGP10.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| Date: Mon, 29 Sep 2003 08:20:01 -0700
| NNTP-Posting-Host: actionjackson133.dsl.frii.net 216.17.147.133
| Lines: 1
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP10.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:188001
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
|
| Hello All,
|
| I have a comma delimited text file, which I would like to move into a
| SQL 2000 table . I created a DTS package in SQL Server and saved it as a
| VB.bas . I am writting the code in C# and I though that I might be able
| to change a few lines and keep the bulk of the code. However , it seems
| that there is a pretty big change in how VB is written and how C#.net is
| written. Does anyone have an example of using DTS and C# to move a few
| hundred records into a SQL Server table?
|
| Thank You in Advance for Your Help,
| Ken
|
|
| *** Sent via Developersdex http://www.developersdex.com ***
| Don't just participate in USENET...get rewarded for it!
|

Nov 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.