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)
 ActiveX code in a DTS

Author  Topic 

pazzy11
Posting Yak Master

145 Posts

Posted - 2007-04-11 : 04:54:26
Hi I want to understand this ActiveX code ...
----------------------------------------------
Function Main()

dim RS

'Create the Record set
set RS = CreateObject("ADODB.Recordset")
set RS = DTSGlobalVariables("gCampaigns").value


DTSGlobalVariables("gCampaignID").value = RS.Fields("code")
DTSGlobalVariables("gCShortName").Value = RS.Fields("shortname")

'Go to next row
RS.MoveNext

'Success
Main = DTSTaskExecResult_Success
End Function

----------------------------------
okay so gCampaignID & gCShortName & gCampaigns are parameters in the DTS package.
but this line
DTSGlobalVariables("gCampaignID").value = RS.Fields("code")
RS:Fields ? is this some structure with Record Sets ?
same question for the next line
DTSGlobalVariables("gCShortName").Value = RS.Fields("shortname")

Also the 1st line ,
set RS = CreateObject("ADODB.Recordset")

maybe it's this that sets this structure ...

any help appreciated , maybe if you could comment the above code ?
also if you could direct me to a good ActiveX tutorial .. cheers..

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2007-04-11 : 09:32:47
yes, you got it. "code" and "shortname" are the name of fields in the select statement.

this is basic ADO code for accessing a recordset. here is the MSDN reference for ADO -- http://msdn.microsoft.com/library/en-us/ado/html/ede1415f-c3df-4cc5-a05b-2576b2b84b60.asp?frame=true

and here is a decent VBScript reference: http://www.w3schools.com/vbscript/default.asp
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-04-11 : 09:38:06
Maybe you need little ADO tutorial:

[url]http://www.vbexplorer.com/VBExplorer/wrox/sample1061.asp[/url]
[url]http://www.w3schools.com/ado/default.asp[/url]

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -