![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi, I want to retrieve some data with the activeX script task, but I always get an error when I want to retrieve a field from the recordset and point it to a local variable. -------------------- dim countr dim Budget set mySourceConn = CreateObject("ADODB.Connection") set mySourceRecordset = CreateObject("ADODB.Recordset") mySourceConn.Open = "Provider=SQLOLEDB.1;Data Source=(local); Initial Catalog=SSRS_Data;user id = 'user';password='pasw'" mySQLCmdText = "SELECT Waarde as Aantal FROM [KPI-variabelen] WHERE code='{2A1B3444-2073-47BD-B1EE-BCC4A3F1FAFE}'" mySourceRecordset.Open mySQLCmdText, mySourceConn, 1 set Budget=mySourceRecordset.Fields("Aantal").value ---------------- The error is on the last line: Object expected, mySourceRecordset.Fields("...").value The recordset should contain a number (eg: 139000). What is wrong with this ? Thanks |
#3
| |||
| |||
|
|
Hello Philippe, Hi, I want to retrieve some data with the activeX script task, but I always get an error when I want to retrieve a field from the recordset and point it to a local variable. -------------------- dim countr dim Budget set mySourceConn = CreateObject("ADODB.Connection") set mySourceRecordset = CreateObject("ADODB.Recordset") mySourceConn.Open = "Provider=SQLOLEDB.1;Data Source=(local); Initial Catalog=SSRS_Data;user id = 'user';password='pasw'" mySQLCmdText = "SELECT Waarde as Aantal FROM [KPI-variabelen] WHERE code='{2A1B3444-2073-47BD-B1EE-BCC4A3F1FAFE}'" mySourceRecordset.Open mySQLCmdText, mySourceConn, 1 set Budget=mySourceRecordset.Fields("Aantal").value ---------------- The error is on the last line: Object expected, mySourceRecordset.Fields("...").value The recordset should contain a number (eg: 139000). What is wrong with this ? Thanks in last line do not use 'set' statement. Why are you using an Activex script in DTS to retrieve a record ? would not be better a SQL Task? Bye |
#4
| |||
| |||
|
|
Hi, Thanks, I'm uwsing the active X task because I want to do this: - retrieve a value out of a database - retrieve another value out of another database - use these 2 in a calculation - write the result to a record in a table Can I accomplish this in another way? Thanks "Davide Rossetti" wrote: Hello Philippe, Hi, I want to retrieve some data with the activeX script task, but I always get an error when I want to retrieve a field from the recordset and point it to a local variable. -------------------- dim countr dim Budget set mySourceConn = CreateObject("ADODB.Connection") set mySourceRecordset = CreateObject("ADODB.Recordset") mySourceConn.Open = "Provider=SQLOLEDB.1;Data Source=(local); Initial Catalog=SSRS_Data;user id = 'user';password='pasw'" mySQLCmdText = "SELECT Waarde as Aantal FROM [KPI-variabelen] WHERE code='{2A1B3444-2073-47BD-B1EE-BCC4A3F1FAFE}'" mySourceRecordset.Open mySQLCmdText, mySourceConn, 1 set Budget=mySourceRecordset.Fields("Aantal").value ---------------- The error is on the last line: Object expected, mySourceRecordset.Fields("...").value The recordset should contain a number (eg: 139000). What is wrong with this ? Thanks in last line do not use 'set' statement. Why are you using an Activex script in DTS to retrieve a record ? would not be better a SQL Task? Bye |
#5
| |||
| |||
|
|
Hello Philippe, Hi, Thanks, I'm uwsing the active X task because I want to do this: - retrieve a value out of a database - retrieve another value out of another database - use these 2 in a calculation - write the result to a record in a table Can I accomplish this in another way? Thanks "Davide Rossetti" wrote: Hello Philippe, Hi, I want to retrieve some data with the activeX script task, but I always get an error when I want to retrieve a field from the recordset and point it to a local variable. -------------------- dim countr dim Budget set mySourceConn = CreateObject("ADODB.Connection") set mySourceRecordset = CreateObject("ADODB.Recordset") mySourceConn.Open = "Provider=SQLOLEDB.1;Data Source=(local); Initial Catalog=SSRS_Data;user id = 'user';password='pasw'" mySQLCmdText = "SELECT Waarde as Aantal FROM [KPI-variabelen] WHERE code='{2A1B3444-2073-47BD-B1EE-BCC4A3F1FAFE}'" mySourceRecordset.Open mySQLCmdText, mySourceConn, 1 set Budget=mySourceRecordset.Fields("Aantal").value ---------------- The error is on the last line: Object expected, mySourceRecordset.Fields("...").value The recordset should contain a number (eg: 139000). What is wrong with this ? Thanks in last line do not use 'set' statement. Why are you using an Activex script in DTS to retrieve a record ? would not be better a SQL Task? Bye You could use two different connection, two SQL Task to retrieve the two values assigning the result of each query to a different Global Variable, do the calculation involving the two Global vars using an ActiveX script and assigning the result to a third Global var and,finally, use a third SQL task to wirite your record passing the third Global var as parmeter for the Insert (or Update) statement. Is it good? Bye |
![]() |
| Thread Tools | |
| Display Modes | |
| |