473,573 Members | 2,958 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to use DTS package in C#

Hi all,
I'm a rookie and would like to know how do I use the DTS
package in my C# code.
I actually want to input a pipe-delimited text file and convert it into
SQL tables and also validate the values in the data field (eg. the
state data field should not have more than 2 chars. .. etc).

Please help!

thanx

Feb 13 '06 #1
2 2561
Hello juventusaurabh,

What's the DTS ?

j> I'm a rookie and would like to know how do I use the DTS
j> package in my C# code.
j> I actually want to input a pipe-delimited text file and convert it
j> into SQL tables and also validate the values in the data field (eg.
j> the state data field should not have more than 2 chars. .. etc).
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Feb 13 '06 #2
Hi,

"juventusaurabh " <sa************ @gmail.com> wrote in message
news:11******** *************@g 47g2000cwa.goog legroups.com...
Hi all,
I'm a rookie and would like to know how do I use the DTS
package in my C# code.
I actually want to input a pipe-delimited text file and convert it into
SQL tables and also validate the values in the data field (eg. the
state data field should not have more than 2 chars. .. etc).


This is what I do, I create the DTS in the enterprise manager, when I'm sure
it does work as expected ( data convertion, etc) I save it in disk, this
create a DTS file, later on I use the code below to set the correct data
connections .
You can set a number of other parameters, take a look at the doc, the code
below will give you an idea of how to start
void RunPackage( string packSource, string packName, string dataSource)
{
try
{
Package2Class package = new Package2Class() ;
object pVarPersistStgO fHost = null;

// if you need to load from file
package.LoadFro mStorageFile(
packSource,
null,
null,
null,
packName,
ref pVarPersistStgO fHost);

package._Packag e_Connections.I tem(1).DataSour ce = dataSource;
package.Execute ();
package.UnIniti alize();

// force Release() on COM object
//
System.Runtime. InteropServices .Marshal.Releas eComObject(pack age);
package = null;
}
catch(System.Ru ntime.InteropSe rvices.COMExcep tion e)
{
Console.WriteLi ne("COMExceptio n {0}", e.ErrorCode.ToS tring() );
Console.WriteLi ne("{0}", e.Message);
Console.WriteLi ne("{0}", e.Source);
Console.WriteLi ne("Stack dump\n{0}\n", e.StackTrace);
Console.ReadLin e();
}
catch(System.Ex ception e)
{
Console.WriteLi ne("Exception") ;
Console.WriteLi ne("{0}", e.Message);
Console.WriteLi ne("{0}", e.Source);
Console.WriteLi ne("Stack dump\n{0}\n", e.StackTrace);

Console.ReadLin e();
}
}

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Feb 13 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
12662
by: chris.dunigan | last post by:
I'm looking for an example of how to execute an existing DTS­ package from an ASP (VB)script and would appreciate any and all response. ­I don't even know if it's possible Thanks - Chuck Gatto Dan Guzman Apr 27 2000, 12:00 am show options
3
1914
by: Petterson Mikael | last post by:
Hi, I have the following package names ( in an xml) that I will transform to html. I need to sort them. <package name="se.company.product.subproduct.boam.fpx.testsignals"> <package name="se.company.product.subproduct.boam.mao.iface.enum.hidden"> When I use <xsl:sort select="." order="ascending"/>
10
4837
by: datapro01 | last post by:
Running DB2 8.1.6A on AIX 5.1 We are experience package cache overflows. The high water mark for package cache is showing as 16,108,513 bytes, or approximately 3933 4K pages. The package cache size is set at Maxapples * 8 Maxapples is at 500.
6
1992
by: Page Horton | last post by:
I have a ASP.NET (VB) web application running. The DTS package is suppose to generates a flat file to a file path (aka: \\myStation\outputFiles\). When it runs it generates the following error on one of the steps (the others run successfully): Step 'Copy Data from Results to H:\Data\outfilename.txt Step' failed Step Error Source:...
3
2825
by: shorti | last post by:
running on AIX with DB2 v8.2.2 I ran across a problem with naming source files with similar names. For instance, if I have these three files: upd_startaccessingdb.sqc upd_startusingdb.sqc upd_startreconproc.sqc and I precompile like so:
1
6725
by: Laurence | last post by:
Hi folks, In the middle of page 231 on the book "Administration Guide - Implementation" stated - "In addition to these package privileges, the BINDADD database privilege allows users to create new packages or rebind an existing package in the database." Previously, I think that the BIND package privilege is required for binding an...
0
6245
debasisdas
by: debasisdas | last post by:
PACKAGE WITH LOCAL FUNCTION ============================= create or replace package my_pkg as procedure my_proc(arg1 in varchar2); function my_fun(arg1 in number) return varchar2; end my_pkg; PACKAGE BODY
0
3872
debasisdas
by: debasisdas | last post by:
The following thread contains some useful tips/sample codes regarding PACKAGES in oracle, that the forum members may find useful. A package is a collection of procedures,functions,cursors,global variables etc. A package is also stored as an Object in the database. A package ha s two parts 1. Package-------------Specification. 2. Package...
0
3834
debasisdas
by: debasisdas | last post by:
SAMPLE PACKAGE EX#3 ==================== PACKAGE SPECIFICATION -------------------------------------------- CREATE OR REPLACE PACKAGE MYPACK AS PROCEDURE SHOWENAME(EMPID IN NUMBER); FUNCTION SHOWSAL(EMPID IN NUMBER) RETURN NUMBER; END MYPACK;
0
1912
by: Steven Samuel Cole | last post by:
Hi Stephane, thanks for your reply! :-) I do not get any notification or warning or whatever from dpkg, all output I get when running # sudo dpkg -i python-<package name>_0.0.1-4927-1_all.deb is Selecting previously deselected package python-<package name>. (Reading database ... 15026 files and directories currently installed.)
0
8165
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7730
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8026
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6347
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5252
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3686
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2163
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1256
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
984
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.