Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Using VB to call a DTS package...

Author  Topic 

murrayb3024
Yak Posting Veteran

79 Posts

Posted - 2005-03-28 : 11:11:58
The user wanted a way to manually start a DTS package that I created. I have been screwing around and built a vb program on the server that has a button and when I click the button it successfully calls the DTS Package. But we don't give them access to the machine the SQL Server sits on. The VB program makes a reference to the Microsoft DTSPackage Object Library. How can I get this package to run on a machine that doesn't have SQL Server installed on it?

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2005-03-28 : 12:06:56
install the client tools on the PC that you'd like to execute the VB application from, and that should install the necessary DMO objects needed to run the package.

- Jeff
Go to Top of Page

murrayb3024
Yak Posting Veteran

79 Posts

Posted - 2005-03-28 : 12:15:00
do the Client Tools require a license?
Go to Top of Page

murrayb3024
Yak Posting Veteran

79 Posts

Posted - 2005-03-28 : 14:26:43
I put the client tools on the desktop I am trying to run the VB app from. I no longer get the 'ActiveX component can't create object' error anymore. I now get 'Run-time error '-2147467259 (80004005)' Login Failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. I am using the following line of code to connect to SQL:

oPKG.LoadFromSQLServer "IP Address\Instance Name", "VBTest", "vbtest01$", DTSSQLStgFlag_UseTrustedConnection, , , , "DTS JOB"

VBTest and vbtest01$ are the username and password I set up in the SQL Server as Admins of the database. Not sure why it says user (null). Any ideas?
Go to Top of Page

murrayb3024
Yak Posting Veteran

79 Posts

Posted - 2005-03-29 : 10:39:40
I tried to use this flag instead:

DTSSQLStgFlag_Default

But when I run the program it just sits there. So I must have to use the other flag. But I still cannot get that one to work on a client machine, anyone else have any ideas?
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2005-03-29 : 10:52:44
what do you mean it just sits there?

What kind of security do you want to use to access the SQL Server -- Trusted or SQL Server? What kind of object is oPKG ? Which libaries are you referencing?

- Jeff
Go to Top of Page

murrayb3024
Yak Posting Veteran

79 Posts

Posted - 2005-03-29 : 10:58:02
The first thing the DTS package is a script to create a backup of the database and store it, this is not happening. basically I click the button and I wait, and wait, etc. When I have this VB app on the server, it starts the DTS package immediately.

Right now I don't care about which type of security, I just want to be able to run this VB app on a client machine that has the SQL Server tools installed and start the DTS package on the test server.

I define oPKG as

Dim oPKG As New DTS.Package

The libraries I reference are:

Visual Basic for Applications
Visual Basic for runtime objects and procedures
Visual Basic objects and procedures
OLE Automation
Microsoft DTSPackage Object Library
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2005-03-29 : 11:13:58
Well, unfortunately, you need to "care" about which type of security you use, it depends on who is running your application and how your SQL Server is configured. Does this make sense? You can't write an app that connects to a secure SQL Server somewhere on the network and have no concern or idea about how it should be logged onto. This is stuff you need to determine in order to get things working.

Hopefully you can find out the proper way you should be accessing this particular SQL Server and then write the code to access it correctly.

I assume you want to use SQL Server security since you are providing a username and a password. So, use the DTSSQLStgFlag_Default option when providing the connect info.

Assuming that step works w/o any errors, are you calling the execute() method on your DTS package? Nothing will happen until you execute the package, obviously.

- Jeff
Go to Top of Page

murrayb3024
Yak Posting Veteran

79 Posts

Posted - 2005-03-29 : 11:21:26
I apologize, I do care about the security, I am just frustrated with my inability to get this working on the client machine. It will be an internal process, and there will only be one user to access this VB App. I would like to SQL Server Security. I also use the following lines of code after my LoadFromServer line:

oPKG.Execute
oPKG.UnInitialize
Set oPKG = Nothing

Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2005-03-29 : 11:26:28
not sure what to tell you ... if you are connecting properly to the package, and the execute method succeeds with no errors (you don't have ON ERROR RESUME NEXT in your code, right? ) then I can't think of what else you might check, other than the fact that the package is working properly and the account you are using to connect to and execute the package has proper permissions to do what it needs to.

- Jeff
Go to Top of Page

hgorijal
Constraint Violating Yak Guru

277 Posts

Posted - 2005-03-30 : 05:13:10
have you used "DTSRUN" ?

Hemanth Gorijala
Exchange a Dollar, we still have ONE each._______Exchange an Idea, we both have TWO each.
Go to Top of Page
   

- Advertisement -