I use DTS to import flat files. Here's a class for my needs that is told
which flat file was found so it can choose the correct DTS package to
run (SQL Server 2000)
You'll need to make a reference to the DTS COM library.
using System;
using DTS;
namespace OOCL.ImportProcessPlan.FileWatcher
{
public enum ImportFileTypes : int {IBFF, INVIEW, JTQ520DOOR,
JTQ510ITM, NSRR, BNSF};
public class ImportFile
{
private ImportFile()
{
}
public static bool Import(ImportFileTypes importFileType)
{
try
{
object oj = new object();
Package2Class pack = new Package2Class();
switch(importFileType)
{
case(ImportFileTypes.BNSF):
pack.LoadFromSQLServer("myserver","","",DTSSQLServerStorageFlags.DTSSQLS
tgFlag_UseTrustedConnection,"","","","BNSF",ref oj);
pack.Execute();
break;
case(ImportFileTypes.NSRR):
pack.LoadFromSQLServer("myserver","","",DTSSQLServerStorageFlags.DTSSQLS
tgFlag_UseTrustedConnection,"","","","NSRR FILE IMPROT",ref oj);
pack.Execute();
break;
case(ImportFileTypes.IBFF):
pack.LoadFromSQLServer("myserver","","",DTSSQLServerStorageFlags.DTSSQLS
tgFlag_UseTrustedConnection,"","","","IBFF IMPORT",ref oj);
pack.Execute();
break;
case(ImportFileTypes.INVIEW):
pack.LoadFromSQLServer("myserver","","",DTSSQLServerStorageFlags.DTSSQLS
tgFlag_UseTrustedConnection,"","","","NAT_INVIEW IMPORT",ref oj);
pack.Execute();
break;
case(ImportFileTypes.JTQ510ITM):
pack.LoadFromSQLServer("myserver","","",DTSSQLServerStorageFlags.DTSSQLS
tgFlag_UseTrustedConnection,"","","","JTQ510 INTERMODAL JOB",ref oj);
pack.Execute();
break;
case(ImportFileTypes.JTQ520DOOR):
pack.LoadFromSQLServer("myserver","","",DTSSQLServerStorageFlags.DTSSQLS
tgFlag_UseTrustedConnection,"","","","JTQ520 IMPORT",ref oj);
pack.Execute();
break;
}
return true;
}
catch (Exception ex)
{
throw ex;
}
}
}
}
Regards,
J. Vince Pacella / OOCL Chicago
10.30 - 7.00 Central
Tel - 773-399-6218 Fax - 773-867-5050
Cargo Tracking Online at:
www.cargosmart.com and www.oocl.com
-----Original Message-----
From: Pradeep Tapadiya [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 26, 2004 1:08 PM
To: [EMAIL PROTECTED]
Subject: [ADVANCED-DOTNET] SQL Server bulk copy operation...
.NETters,
I need to pump huge number of records into a SQL Server database. The
default SQL Server ADO .NET connector doesn't seem to support any bulk
copy operations. I am wondering if I simply overlooked something or if
there is a newer SQL Server ADO .NET connector that can be downloaded.
I see that the new ADO .NET connector under Longhorn supports bulk data
operations. Is this connector available for download somewhere?
http://longhorn.msdn.microsoft.com/lhsdk/ndp/adconusingadonettobulkcopyd
atat
osqlserver.aspx
Thank you in advance for your help.
Pradeep
===================================
This list is hosted by DevelopMentor(r) http://www.develop.com Some
.NET courses you may be interested in:
NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls
View archives and manage your subscription(s) at
http://discuss.develop.com
IMPORTANT NOTICE
Email from OOCL is confidential and may be legally privileged. If it is not intended
for you, please delete it immediately unread. The internet cannot guarantee that this
communication is free of viruses, interception or interference and anyone who
communicates with us by email is taken to accept the risks in so doing. Without
limitation, OOCL and its affiliates accept no liability whatsoever and howsoever
arising in connection with the use of this email. Under no circumstances shall this
email constitute a binding agreement to carry or for provision of carriage services by
OOCL, which is subject to the availability of carrier's equipment and vessels and the
terms and conditions of OOCL's standard bill of lading which is also available at
http://www.oocl.com.
===================================
This list is hosted by DevelopMentor� http://www.develop.com
Some .NET courses you may be interested in:
NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls
View archives and manage your subscription(s) at http://discuss.develop.com