![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | DataSet object I have the following script which runs a stored procedure and returns the resultset to a dataset object. Then, I need to loop through the dataset to write each element to text files. I get an error when I try to access properties related to the DataSet object. Am I not declaring it properly? Thanks in advance for your help. KE ''Need BatchId passed in Dim objCmd,objResultSet, objFSO, intRecordCount Dim lngRetVal, strOutputParam, strFileName, strRej, strLog, strPath Dim OFileQALog, oFileQARej, oFileProdLog, oFileProdRej Set objCmd = CreateObject("ADODB.Command") Set objFSO = CreateObject("scripting.FileSystemObject") Set ObjResultSet=CreateObject("ADODB.RECORDSET") ObjCmd.ActiveConnection = "Provider=SQLOLEDB;Data Source=hp-kelliott \captech1; Trusted_connection=Yes;Initial Catalog=Master;" ObjCmd.CommandType = 4 'Stored Procedures ObjCmd.CommandText = "SP_GetFileNames" strRej = ".rej" strPath = "C:\Documents and Settings\kelliott\My Documents\Captech\HMC \ACES" ''this is where the problem lies strLog = "_log" set oFileQALog = objFSO.CreateTextFile(strPath&"\filelist_qalog.txt", TRUE) set oFileQARej = objFSO.CreateTextFile(strPath&"\filelist-qarej.txt", TRUE) set oFileProdRej = objFSO.CreateTextFile(strPath&"\filelist- prodrej.txt", TRUE) set oFileProdLog = objFSO.CreateTextFile(strPath&"\filelist- prodlog.txt", TRUE) ObjCmd.Parameters.Refresh ObjCmd.Parameters(1).Value = 1 ''set this equal to BatchId parameter ''ObjResultSet.EnableRecordCount ObjResultSet = ObjCmd.Execute() LngRetVal = ObjCmd.Parameters(0).Value Do While not objResultSet.EOF strFileName = ObjResultSet("FName") IF INSTR (strFileName, strRej) <> 0 Then oFileQARej.WriteLine(strPath & strFilename) ''need to transform it in the sp (log & rej) oFileProdRej.WriteLine(strPath & strFilename) ''need to add in filename and need to transform it in the sp (log & rej) END IF IF INSTR (strFileName, strLog) <> 0 Then oFileQALog.WriteLine(strPath & strFilename) oFileProdLog.WriteLine(strPath & strFilename) END IF objResultSet.MoveNext Loop objResultSet.Close WScript.Quit(0) objCmd = Nothing |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Inherit from usercontrol - Object not set to instance of an object | .NET General | |||
| datalist -- Object reference not set to an instance of an object. | .NET General | |||
| DataSet Designer | .NET General | |||
| Testing object arrays using Compare-Object and -contains | PowerShell | |||
| Adding canonical aliases for Compare-Object, Measure-Object, New-Object | PowerShell | |||