dbTalk Databases Forums  

DTS and VB.NET coding

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


Discuss DTS and VB.NET coding in the microsoft.public.sqlserver.dts forum.



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

Default DTS and VB.NET coding - 05-12-2004 , 11:41 AM






I am trying to build a VB.NET Application that will create DTS packages including custom tasks etc.
I have previously done this in VB6.0 and it worked fine but am having trouble converting my old code to .NET

'some VB.NET code..

Imports DT
Imports DTSCustTask
Imports DTSPum

'some DTS stuff..

Dim oConnection As DTS.Connection

oConnection = goPackage.Connections.New("SQLOLEDB"
oConnection.ConnectionProperties("Persist Security Info") = Tru

'end of code snippet

The DTS code would work in VB6.0 - I know I've seen it :

What I get in the Visual Studio .NET IDE is blue wavy lines under the "oConnection.ConnectionProperties" bit and the compile error

"Interface 'DTS.OleDBProperties' cannot be indexed because it has no default property.

Is this something to do with COMInterOp? What should I be doing to get it to work

I have previously Referenced the COM InterOp library at the project level and have "Imports System.Runtime.InteropServices" too..

TI

alaspin (AT) yahoo (DOT) co


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

Default Re: DTS and VB.NET coding - 05-12-2004 , 12:56 PM






In message <E24C985B-49C0-4199-99C3-19DFA5E608F4 (AT) microsoft (DOT) com>, alaspin
<anonymous (AT) discussions (DOT) microsoft.com> writes
Quote:
I am trying to build a VB.NET Application that will create DTS packages
including custom tasks etc..
I have previously done this in VB6.0 and it worked fine but am having
trouble converting my old code to .NET.

'some VB.NET code...

Imports DTS
Imports DTSCustTasks
Imports DTSPump

'some DTS stuff...
Dim oConnection As DTS.Connection2

oConnection = goPackage.Connections.New("SQLOLEDB")
oConnection.ConnectionProperties("Persist Security Info") = True

'end of code snippet

The DTS code would work in VB6.0 - I know I've seen it

What I get in the Visual Studio .NET IDE is blue wavy lines under the
"oConnection.ConnectionProperties" bit and the compile error:

"Interface 'DTS.OleDBProperties' cannot be indexed because it has no
default property."

..Net does not really do default properties, and as the error says it
needs a property to set for the OleDBPropertie object underpinning the
OleDBProperties collection.

Haven't got a machine to test here, but try-

oConnection.ConnectionProperties("Persist Security Info").Value = True


Converting a DTS Package from Visual Basic 6.0 to Visual Basic .Net
(http://www.sqldts.com/default.aspx?264)

--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org



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.