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
 Import/Export (DTS) and Replication (2000)
 Executing a query in DTS

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-05-07 : 11:19:28
Vijay writes "Hi

I am trying to execute a tsql query in activex script in DTS. I do not want to create a connection as it will hard code the connecting string. I want to refer the connection object

my activex script looks like the following
function Main()

' Declare variables
Dim oPkg
Dim ocn
dim sSql
Set oConn = CreateObject("ADODB.Connection")


' Get reference to current package
Set oPkg = DTSGlobalVariables.Parent
' Get reference to Access connection, by name
set ocn = oPkg.Connections("Microsoft OLE DB Provider for SQL Server")
'Open the connection

?????How do I open the connection and execute an sql

Thanks "

nr
SQLTeam MVY

12543 Posts

Posted - 2004-05-07 : 11:41:55
>> I do not want to create a connection as it will hard code the connecting string
You can change the connection string at run time.

But see
http://www.nigelrivett.net/DTSExecuteStoredProcedure.html
For executing an SP from an activex script.

==========================================
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.
Go to Top of Page
   

- Advertisement -