dbTalk Databases Forums  

Can't get DTS from VB example to work

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


Discuss Can't get DTS from VB example to work in the microsoft.public.sqlserver.dts forum.



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

Default Can't get DTS from VB example to work - 06-20-2005 , 02:13 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?

BBM

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

Default Re: Can't get DTS from VB example to work - 06-20-2005 , 02:25 PM






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


"BBM" <bbm (AT) bbmcompany (DOT) com> wrote

Quote:
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?

BBM



Reply With Quote
  #3  
Old   
BBM
 
Posts: n/a

Default Re: Can't get DTS from VB example to work - 06-20-2005 , 03:10 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_UseTrustedC onnection 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


"Allan Mitchell" wrote:

Quote:
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


"BBM" <bbm (AT) bbmcompany (DOT) com> wrote in message
news:21A3F368-DD48-45AC-AA26-790A45FD5B19 (AT) microsoft (DOT) com...
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?

BBM




Reply With Quote
  #4  
Old   
Darren Green
 
Posts: n/a

Default Re: Can't get DTS from VB example to work - 06-23-2005 , 06:06 AM



<snip>
Quote:
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.
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




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.