dbTalk Databases Forums  

Execute a DTS package from VB - Error in Dynamically Changing Text file path

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


Discuss Execute a DTS package from VB - Error in Dynamically Changing Text file path in the microsoft.public.sqlserver.dts forum.



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

Default Execute a DTS package from VB - Error in Dynamically Changing Text file path - 10-15-2003 , 12:29 AM







Sub : Execute a DTS package from VB - Error in Dynamically Changing
Text file path

------------------------------------------------------------------------
----------

'Executing a DTS package from Visual Basic code.Works fine but if
i am trying to change textfile path then its giving error
"Connection "textFile" was not found". I am using Sql 7 and Sql 2000
server as backend

Wt could be the reason ?



Need help urgentely

------------------------------------------------------------------------
----------



Private Sub SimpleExecutePackage()

Dim oPKG As New DTS.Package

oPKG.LoadFromSQLServer "MyServer", , , _
DTSSQLStgFlag_UseDefaultConnection, , , , "MyPackage"



' Set Filename

Set oConn = oPKG.Connections("TextFile") ------- error on this line

oConn.DataSource = txtFilename.Text

Set oConn = Nothing



oPKG.Execute

oPKG.UnInitialize

Set oPKG = Nothing

End Sub



------------------------------------------------------------------------
----------


--
Posted via http://dbforums.com

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

Default Re: Execute a DTS package from VB - Error in Dynamically Changing Text file path - 10-15-2003 , 01:30 AM






Without seeing the code you use who knows ?

--

----------------------------
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org



"yogesht194" <member44179 (AT) dbforums (DOT) com> wrote

Quote:
Sub : Execute a DTS package from VB - Error in Dynamically Changing
Text file path

------------------------------------------------------------------------
----------

'Executing a DTS package from Visual Basic code.Works fine but if
i am trying to change textfile path then its giving error
"Connection "textFile" was not found". I am using Sql 7 and Sql 2000
server as backend

Wt could be the reason ?



Need help urgentely

------------------------------------------------------------------------
----------



Private Sub SimpleExecutePackage()

Dim oPKG As New DTS.Package

oPKG.LoadFromSQLServer "MyServer", , , _
DTSSQLStgFlag_UseDefaultConnection, , , , "MyPackage"



' Set Filename

Set oConn = oPKG.Connections("TextFile") ------- error on this line

oConn.DataSource = txtFilename.Text

Set oConn = Nothing



oPKG.Execute

oPKG.UnInitialize

Set oPKG = Nothing

End Sub



------------------------------------------------------------------------
----------


--
Posted via http://dbforums.com



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.