all groups > sql server dts > february 2004 >
You're in the

sql server dts

group:

dts in visual basic.net


Re: dts in visual basic.net Allan Mitchell
2/13/2004 8:45:55 AM
sql server dts:
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


[quoted text, click to view]

dts in visual basic.net fabian
2/13/2004 9:34:01 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()

Re: dts in visual basic.net fabian
2/13/2004 11:27:18 AM
sorry, can you give me any example. I'm newbee in this area.

"Allan Mitchell" <allan@no-spam.sqldts.com> escribió en el mensaje
news:u6mvwzg8DHA.712@tk2msftngp13.phx.gbl...
[quoted text, click to view]

Re: dts in visual basic.net fabian
2/13/2004 4:14:32 PM
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@navegalia.com> escribió en el mensaje
news:%23hsBjvh8DHA.2576@TK2MSFTNGP11.phx.gbl...
[quoted text, click to view]

Re: dts in visual basic.net Allan Mitchell
2/13/2004 4:41:14 PM
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


[quoted text, click to view]

AddThis Social Bookmark Button