all groups > sql server dts > june 2005 >
You're in the

sql server dts

group:

Can't get DTS from VB example to work


Re: Can't get DTS from VB example to work Allan Mitchell
6/20/2005 12:00:00 AM
sql server dts:
have you read Gert's article?

(Don't foget you will still need the DTS dlls)

http://www.sqldev.net/dts/DotNETCookBook.htm

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


[quoted text, click to view]

Can't get DTS from VB example to work BBM
6/20/2005 12:13:02 PM
I have a DTS package that I created using the DTS Wizard. I've tested it and
it works.

Now I want to execute that package from a VB.Net program. I downloaded the
code example from the MSDN Website and am trying to follow it - so far with
no success.

My code looks like this...

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim dtsp As New DTS.Package
dtsp.LoadFromSQLServer( _
ServerName:="STEVE", _
ServerUserName:="Stephen", _
ServerPassword:="mypassword", _
PackageName:="myPackage")
dtsp.Execute()
End Sub

When I click the button, I get an error message that says that...

An unhandled exception of type 'System.Runtime.InteropServices.COMException'
occurred in DTS.exe

Additional information: Login failed for user 'Stephen'. Reason: Not
associated with a trusted SQL Server connection.

SQL Server is set up to use the "Windows" security mode.

User "Stephen" is valid in both Windows and in SQL Server. Stephen is a
member of the "Administrators" group in windows. In SQL Server
"STEVE/Stephen" ("STEVE" is the name of my local database) is in the System
Administrators role.

When I go to the Enterprise Manager (after logging on to Windows as
"Stephen") I get straight in. It sure looks to me like "Stephen" has a
trusted connection.

Any ideas?

Re: Can't get DTS from VB example to work BBM
6/20/2005 1:10:05 PM
Hi Allan,

Thanks for your response. I got my program to work by using Gert's example.

Apparently if you want to use the "Windows" security option you leave the
User and PassWord parms blank in the "LoadFromSQLServer" call and instead use
the enumerated type parm
DTSSQLServerStorageFlags.DTSSQLStgFlag_UseTrustedConnection instead. That
seemed to do the trick. This little tidbit was not mentioned in the MS
article (it wasn't mentioned on Gert's either, but he used Windows security
with his example).

I didn't have to do the the all the "runtime callable wrapper" stuff that
was listed on Gert's site. I looked at the date on that stuff, and it must
have pre-dated VS 2003. All I did was add a reference to the COM object
Microsoft DTS Object Library to my project and it seemed to work.

Now on to parameterized queries with DTS. Thanks for the tip - a REALLY big
help.
And thanks to Gert for filling in for covering for MS!

BBM


[quoted text, click to view]
Re: Can't get DTS from VB example to work Darren Green
6/23/2005 12:06:47 PM
<snip>
[quoted text, click to view]

By adding a reference to the component in VS, then VS creates the RCW for
you. You will see this in your output folder. What Gert suggest is that you
create a strong named RCW once, put it in the GAC, and then add a
referenmnce to that, rather than having one RCW per program.


--
Darren Green
http://www.sqldts.com
http://www.sqlis.com

AddThis Social Bookmark Button