dbTalk Databases Forums  

Passing parameter to DTS via VB

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


Discuss Passing parameter to DTS via VB in the microsoft.public.sqlserver.dts forum.



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

Default Passing parameter to DTS via VB - 04-02-2004 , 04:01 PM






I'm using VB 6 with SQL 2000. I have a DTS package that works correctly in SQL Enterprise Manager. Now I have to incorporate it into a VB 6 application.

I'm using the following code
' Declare SQL DTS Object
Dim oPKG As DTS.Package, oStep As DTS.Ste
Set oPKG = New DTS.Packag
Dim sServer As String, sUsername As String, sPassword As Strin
Dim sPackageName As String, sMessage As Strin
Dim lErr As Long, sSource As String, sDesc As String, FileLoc As Strin


FileLoc = FilePat

' Set Parameter Value
sServer = "Server_Leadpool
sUsername = "sa
sPassword = "sa
sPackageName = "dtsProcess_DVSPledgeFile

' Load Packag
oPKG.LoadFromSQLServer sServer, sUsername, sPassword, DTSSQLStgFlag_UseTrustedConnection, , , , sPackageNam

oPKG.GlobalVariables("FileLocation").Value = FileLo

' Set Exec on Main Threa
For Each oStep In oPKG.Step
oStep.ExecuteInMainThread = Tru
Nex

' Execut
oPKG.Execut
oPKG.UnInitializ
Set oStep = Nothin
Set oPKG = Nothin

The process runs without an error that I know of but at the same time nothing is being done. The DTS package is supposed to populate two tables. Both of the tables are empty and the file that is getting processed has over 200 records

How can I check to see if the package is being triggered to run and insert some error checking. Thank you very muc



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

Default Re: Passing parameter to DTS via VB - 04-04-2004 , 10:09 AM






Why are you passing a SQL Server Username and Password and then telling SQL
Server to use a Trusted Connection?


Have the package.

Fail On First Error
Log to a Text File

Check the steps at the end of the code i.e.

Execute a package from Visual Basic (VB)
(http://www.sqldts.com/default.aspx?208,2)

--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
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


"Eugene" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
I'm using VB 6 with SQL 2000. I have a DTS package that works correctly
in SQL Enterprise Manager. Now I have to incorporate it into a VB 6
application.
Quote:
I'm using the following code:
' Declare SQL DTS Objects
Dim oPKG As DTS.Package, oStep As DTS.Step
Set oPKG = New DTS.Package
Dim sServer As String, sUsername As String, sPassword As String
Dim sPackageName As String, sMessage As String
Dim lErr As Long, sSource As String, sDesc As String, FileLoc As
String


FileLoc = FilePath

' Set Parameter Values
sServer = "Server_Leadpool"
sUsername = "sa"
sPassword = "sa"
sPackageName = "dtsProcess_DVSPledgeFile"

' Load Package
oPKG.LoadFromSQLServer sServer, sUsername, sPassword,
DTSSQLStgFlag_UseTrustedConnection, , , , sPackageName

oPKG.GlobalVariables("FileLocation").Value = FileLoc

' Set Exec on Main Thread
For Each oStep In oPKG.Steps
oStep.ExecuteInMainThread = True
Next

' Execute
oPKG.Execute
oPKG.UnInitialize
Set oStep = Nothing
Set oPKG = Nothing

The process runs without an error that I know of but at the same time
nothing is being done. The DTS package is supposed to populate two tables.
Both of the tables are empty and the file that is getting processed has over
200 records.
Quote:
How can I check to see if the package is being triggered to run and insert
some error checking. Thank you very much





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.