Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - DataSet object

Reply
 
Old 04-07-2009   #1 (permalink)
k88elliott


 
 

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 SpecsSystem Spec
Reply

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


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46