Custom Recordset in global variable | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Custom Recordset in global variable

Hi. What I’m trying to do is create a custom recordset in a DTS package which I want to populate with data from several database servers. I’m trying to figure that out and I’ve hit a bit of a road block. Right now I have the following. Function Main()
On Error Resume Next Dim ds
set ds = CreateObject("ADODB.Recordset")
ds.Fields.Append "FName", adVarChar, 10
ds.Fields.Append "MName", adVarChar, 10
ds.Fields.Append "LName", adVarChar, 10
ds.Open ds.AddNew
ds.Fields("FName") = "John"
ds.Fields("MName") = "Jacob"
ds.Fields("LName") = "Smith"
ds.Update MsgBox TypeName(ds)
DTSGlobalVariables("g_BINToBeProcessed") = ds Dim ds2
ds2 = DTSGlobalVariables("g_BINToBeProcessed") MsgBox TypeName(DS2) Main = DTSTaskExecResult_Success End Function My problem is that I am assigning a Recordset but when I got to assign that global variable to another variable it comes back as a Field which doesn’t work for me. Does anyone know how I can keep my recordset as a recordset? Thanks, Jerry
Nevermind. I changed:
DTSGlobalVariables("g_BINToBeProcessed") = ds
set DTSGlobalVariables("g_BINToBeProcessed") = ds
…and it started working.