dbTalk Databases Forums  

dts in visual basic.net

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss dts in visual basic.net in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
fabian
 
Posts: n/a

Default dts in visual basic.net - 02-13-2004 , 02:34 AM






Hi, I've got a DTS package in SQL, it imports a text file into a table. I'm
executing the dts from visual basic.net but the name of the file is inside
the package, so I can't change it. Can I pass the name of file as parameter?
the code in visual basic is :
Dim pkg As DTS.Package

pkg = New DTS.Package

pkg.LoadFromSQLServer(<server>, <user>, <password>, _

DTSSQLServerStorageFlags.DTSSQLStgFlag_Default, _

"", "", "", <package name>, Nothing)

pkg.Execute()



pkg.UnInitialize()



Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: dts in visual basic.net - 02-13-2004 , 02:45 AM






You can. Look at the Connections collection of the package and find your
particular connection name/provider. You can then set the DataSource
property.


--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"fabian" <fabianbg (AT) navegalia (DOT) com> wrote

Quote:
Hi, I've got a DTS package in SQL, it imports a text file into a table.
I'm
executing the dts from visual basic.net but the name of the file is inside
the package, so I can't change it. Can I pass the name of file as
parameter?
the code in visual basic is :
Dim pkg As DTS.Package

pkg = New DTS.Package

pkg.LoadFromSQLServer(<server>, <user>, <password>, _

DTSSQLServerStorageFlags.DTSSQLStgFlag_Default, _

"", "", "", <package name>, Nothing)

pkg.Execute()



pkg.UnInitialize()





Reply With Quote
  #3  
Old   
fabian
 
Posts: n/a

Default Re: dts in visual basic.net - 02-13-2004 , 04:27 AM



sorry, can you give me any example. I'm newbee in this area.

"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> escribió en el mensaje
news:u6mvwzg8DHA.712 (AT) tk2msftngp13 (DOT) phx.gbl...
Quote:
You can. Look at the Connections collection of the package and find your
particular connection name/provider. You can then set the DataSource
property.


--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"fabian" <fabianbg (AT) navegalia (DOT) com> wrote in message
news:%230gXPwg8DHA.1356 (AT) tk2msftngp13 (DOT) phx.gbl...
Hi, I've got a DTS package in SQL, it imports a text file into a table.
I'm
executing the dts from visual basic.net but the name of the file is
inside
the package, so I can't change it. Can I pass the name of file as
parameter?
the code in visual basic is :
Dim pkg As DTS.Package

pkg = New DTS.Package

pkg.LoadFromSQLServer(<server>, <user>, <password>, _

DTSSQLServerStorageFlags.DTSSQLStgFlag_Default, _

"", "", "", <package name>, Nothing)

pkg.Execute()



pkg.UnInitialize()







Reply With Quote
  #4  
Old   
fabian
 
Posts: n/a

Default Re: dts in visual basic.net - 02-13-2004 , 09:14 AM



I've tried with:
Dim oconn As DTS.Connection



oconn = pkg.Connections()

oconn.DataSource = "C:\bcp.txt"

oConn = Nothing

but it fires an exception : "The specified casting is not valid"

"fabian" <fabianbg (AT) navegalia (DOT) com> escribió en el mensaje
news:%23hsBjvh8DHA.2576 (AT) TK2MSFTNGP11 (DOT) phx.gbl...
Quote:
sorry, can you give me any example. I'm newbee in this area.

"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> escribió en el mensaje
news:u6mvwzg8DHA.712 (AT) tk2msftngp13 (DOT) phx.gbl...
You can. Look at the Connections collection of the package and find
your
particular connection name/provider. You can then set the DataSource
property.


--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"fabian" <fabianbg (AT) navegalia (DOT) com> wrote in message
news:%230gXPwg8DHA.1356 (AT) tk2msftngp13 (DOT) phx.gbl...
Hi, I've got a DTS package in SQL, it imports a text file into a
table.
I'm
executing the dts from visual basic.net but the name of the file is
inside
the package, so I can't change it. Can I pass the name of file as
parameter?
the code in visual basic is :
Dim pkg As DTS.Package

pkg = New DTS.Package

pkg.LoadFromSQLServer(<server>, <user>, <password>, _

DTSSQLServerStorageFlags.DTSSQLStgFlag_Default, _

"", "", "", <package name>, Nothing)

pkg.Execute()



pkg.UnInitialize()









Reply With Quote
  #5  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: dts in visual basic.net - 02-13-2004 , 10:41 AM



OK
Connections is a collection not an item

so UNTESTED

oconn = pkg.Connections.Item("Name of Connection")
oconn.DataSource = "filepath"



--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"fabian" <fabianbg (AT) navegalia (DOT) com> wrote

Quote:
I've tried with:
Dim oconn As DTS.Connection



oconn = pkg.Connections()

oconn.DataSource = "C:\bcp.txt"

oConn = Nothing

but it fires an exception : "The specified casting is not valid"

"fabian" <fabianbg (AT) navegalia (DOT) com> escribió en el mensaje
news:%23hsBjvh8DHA.2576 (AT) TK2MSFTNGP11 (DOT) phx.gbl...
sorry, can you give me any example. I'm newbee in this area.

"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> escribió en el mensaje
news:u6mvwzg8DHA.712 (AT) tk2msftngp13 (DOT) phx.gbl...
You can. Look at the Connections collection of the package and find
your
particular connection name/provider. You can then set the DataSource
property.


--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"fabian" <fabianbg (AT) navegalia (DOT) com> wrote in message
news:%230gXPwg8DHA.1356 (AT) tk2msftngp13 (DOT) phx.gbl...
Hi, I've got a DTS package in SQL, it imports a text file into a
table.
I'm
executing the dts from visual basic.net but the name of the file is
inside
the package, so I can't change it. Can I pass the name of file as
parameter?
the code in visual basic is :
Dim pkg As DTS.Package

pkg = New DTS.Package

pkg.LoadFromSQLServer(<server>, <user>, <password>, _

DTSSQLServerStorageFlags.DTSSQLStgFlag_Default, _

"", "", "", <package name>, Nothing)

pkg.Execute()



pkg.UnInitialize()











Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.