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.
Author |
Topic |
Taragor
Starting Member
46 Posts |
Posted - 2005-07-15 : 13:41:21
|
Hi everyone,I'm having a few problems using the DTS features of MSSQL 2000. In particular, passing a variable to DTS. I've looked around for different examples on how to manipulate DTS from within visual studio .net but am still unable to get things working. The simplest test was to create a DTS package with a global variable defined to the package itself (created in the package properties menu option), with an activeX script task. Global Variable is named TestVar with the value "This is a test" (without quotes)Within the activex script I added:msgbox DTSGlobalVariables("TestVar").ValueWhen I run the package within enterprise manager it works fine. (A message box appears with "This is a test" displayed). But when I try to run the DTS package from VS nothing happens. I don't get any errors it just doesn't do anything. The code in VS is as follows:'objPackage.LoadFromSQLServer("ServerName", "sa", "sa", DTS.DTSSQLServerStorageFlags.DTSSQLStgFlag_Default, , "{89838737-D1F5-4D9C-BAC1-E5202A46CEED}", "{B7E7380F-DA09-4622-B8DD-B4E2D1C25E98}", "example") 'objPackage.GlobalVariables.Item("TestVar").Value = txtGlobalVariable.Text 'objPackage.Execute() 'objPackage.UnInitialize()- *The objpackage definition is 1 line.- txtGlobalVariable.Text is a text box on the form. The text entered should be what appears in the message box when the DTS executes.As I said. I can run the application and I get no errors. It just doesn't return anything. I tried removing the username, pw and I get an error message that the user is not authenticated so I'm assuming that it is in affect talking to the sql server to some degree.I've tried using a trusted connection, tried removing the package and version guid to no avail.If you have any suggestions it would be greatly appreciated,TarP.S. The original project is a web based project so I'm curious also if there will be anything specific I'll need to change from a winform type application. |
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2005-07-18 : 15:53:04
|
The instruction will be executed on the server and so will probably be trying to display the msgbox on a monitor connected to iis.Try changing the variabl;e in the package - appending a value then reading it back and updating the textbox.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
lizak
Starting Member
12 Posts |
Posted - 2005-07-22 : 08:46:21
|
On a more general note - Your message box test is bringing other issues into the mix that is complicating your stated intent of working with a parameter.Unless you really need to display a message box, try something simplier like writing a record to a table or file or something. As "nr" states, the same DTS task executed off the server is different than being executed from your PC using Enterprise Manager.-EJL |
 |
|
|
|
|
|
|