![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi, In an ActiveX VBScript I need to be able to create a recordset in code. Normally, I would use the ExecuteSQLTask, load it into a Global Variable and set rs = DTSGlobalVariables ("gvRS").Value and then use the recordset. This won't work because the SQL I want to execute is "SELECT SeqNumber, CompanyNumber FROM ?" The execute SQL task will only allow an input variable from the where clause, it will not accept a ? as a TableName which is what I need to pass to it. I have successfully created a custom DTSexecuteSQL: Set oSQLTask=oPackage.Tasks.New ("DTSExecuteSQLTask") And successfully executed SQL in Tables using the "oPackage.Steps("AutoSQLExecute").Execute" If I create the SQL and try to "set rs = oPackage.Steps ("AutoSQLExecute").Execute" It gives me an error. Can anyone tell me how to create and ADO Recordset in VBScript that will work in a DTS ActiveXScript? Thanks! |
#3
| |||
| |||
|
|
-----Original Message----- Hi Julie Here is an example: JFB ![]() '************************************************* ******** ************* ' Visual Basic ActiveX Script '************************************************* ******** *************** Function Main() Dim countr ' Connection to SQL set mySourceConn=CreateObject("ADODB.Connection") set mySourceRecordset=CreateObject("ADODB.Recordset") mySourceConn.Open="Provider=SQLOLEDB;Trusted_Conne ction=ye s; Data Source=ServerName; Initial Catalog=Northwind; user id='user'; password='pwd'" mySQLCmdText= "select orderID from orders" mySourceRecordset.open mySQLCmdText, mySourceConn msgbox mySQLCmdText msgbox mySourceRecordset.RecordCount If IsNull(mySourceRecordset.EOF) or (mySourceRecordset.cachesize < 1) Then num=1 Else For countr =1 to mySourceRecordset.RecordCount num=mySourceRecordset.Fields("orderID").value mySourceRecordset.MoveNext Next End if mySourceRecordset.close Main = DTSTaskExecResult_Success End Function "Julie Pemberton" <JPemberton (AT) Prac (DOT) Com> wrote in message news:04b001c37def$fe1ac990$3101280a (AT) phx (DOT) gbl... Hi, In an ActiveX VBScript I need to be able to create a recordset in code. Normally, I would use the ExecuteSQLTask, load it into a Global Variable and set rs = DTSGlobalVariables ("gvRS").Value and then use the recordset. This won't work because the SQL I want to execute is "SELECT SeqNumber, CompanyNumber FROM ?" The execute SQL task will only allow an input variable from the where clause, it will not accept a ? as a TableName which is what I need to pass to it. I have successfully created a custom DTSexecuteSQL: Set oSQLTask=oPackage.Tasks.New ("DTSExecuteSQLTask") And successfully executed SQL in Tables using the "oPackage.Steps("AutoSQLExecute").Execute" If I create the SQL and try to "set rs = oPackage.Steps ("AutoSQLExecute").Execute" It gives me an error. Can anyone tell me how to create and ADO Recordset in VBScript that will work in a DTS ActiveXScript? Thanks! . |
#4
| |||
| |||
|
|
Hi, In an ActiveX VBScript I need to be able to create a recordset in code. Normally, I would use the ExecuteSQLTask, load it into a Global Variable and set rs = DTSGlobalVariables ("gvRS").Value and then use the recordset. This won't work because the SQL I want to execute is "SELECT SeqNumber, CompanyNumber FROM ?" The execute SQL task will only allow an input variable from the where clause, it will not accept a ? as a TableName which is what I need to pass to it. I have successfully created a custom DTSexecuteSQL: Set oSQLTask=oPackage.Tasks.New ("DTSExecuteSQLTask") And successfully executed SQL in Tables using the "oPackage.Steps("AutoSQLExecute").Execute" If I create the SQL and try to "set rs = oPackage.Steps ("AutoSQLExecute").Execute" It gives me an error. Can anyone tell me how to create and ADO Recordset in VBScript that will work in a DTS ActiveXScript? Thanks! |
#5
| |||
| |||
|
|
Hi Julie Here is an example: JFB ![]() '************************************************* ********************* ' Visual Basic ActiveX Script '************************************************* *********************** Function Main() Dim countr ' Connection to SQL set mySourceConn=CreateObject("ADODB.Connection") set mySourceRecordset=CreateObject("ADODB.Recordset") mySourceConn.Open="Provider=SQLOLEDB;Trusted_Conne ction=yes; Data Source=ServerName; Initial Catalog=Northwind; user id='user'; password='pwd'" mySQLCmdText= "select orderID from orders" mySourceRecordset.open mySQLCmdText, mySourceConn msgbox mySQLCmdText msgbox mySourceRecordset.RecordCount If IsNull(mySourceRecordset.EOF) or (mySourceRecordset.cachesize 1) Then num=1 Else For countr =1 to mySourceRecordset.RecordCount num=mySourceRecordset.Fields("orderID").value mySourceRecordset.MoveNext Next End if mySourceRecordset.close Main = DTSTaskExecResult_Success End Function "Julie Pemberton" <JPemberton (AT) Prac (DOT) Com> wrote in message news:04b001c37def$fe1ac990$3101280a (AT) phx (DOT) gbl... |
![]() |
| Thread Tools | |
| Display Modes | |
| |