Hello, 

I am trying to use sql request in vbs script to return value in the table Directory, but when i did it , i have a error

 I don't understand , could you help me ?

this  is a piece of script :

' Join File table to Component table in order to find directories
Dim orderBy : If sequenceFile Then orderBy = "Directory_" Else orderBy = "Sequence"
Set view = database.OpenView("SELECT File,FileName,Directory_,Sequence,File.Attributes FROM File,Component WHERE Component_=Component ORDER BY " & orderBy) : CheckError
view.Execute : CheckError


' Fetch each file and request the source path, then verify the source path
Dim fileKey, fileName, folder, sourcePath, delim, message, attributes
Do
	Set record = view.Fetch : CheckError
	If record Is Nothing Then Exit Do
	fileKey    = record.StringData(1)
	fileName   = record.StringData(2)
	folder     = record.StringData(3)
	sequence   = record.IntegerData(4)
	attributes = record.IntegerData(5)
	If (attributes And msidbFileAttributesNoncompressed) = 0 Then
		If sequence <= lastSequence Then
			If Not sequenceFile Then Fail "Duplicate sequence numbers in File table, use /S option"
			sequence = lastSequence + 1
			record.IntegerData(4) = sequence
			view.Modify msiViewModifyUpdate, record
		End If
		lastSequence = sequence
		delim = InStr(1, fileName, "|", vbTextCompare)
		If delim <> 0 Then
			If shortNames Then fileName = Left(fileName, delim-1) Else fileName = Right(fileName, Len(fileName) - delim)
		End If
	
	    Wscript.Echo "Test chr(39) = " & chr(39)
		
		Wscript.Echo "folder = " & folder
		Wscript.Echo "sourcePath = " & sourcePath
		Wscript.Echo "Property = " & session.Property(folder)
		Wscript.Echo "SourceDir = " & session.Property("SourceDir")
	
		Set view_dir = database.OpenView("SELECT DefaultDir FROM Directory WHERE Directory=" &  folder ) : CheckError
		view_dir.Execute : CheckError
		Set record_dir = view_dir.Fetch : CheckError
		
		
		
		
		sourcePath = session.SourcePath(folder) & fileName
		'Wscript.Echo "TargetPath = " & session.TargetPath(folder) 
		
		outStream.WriteLine """" & sourcePath & """" & " " & fileKey
		If installer.FileAttributes(sourcePath) = -1 Then message = message & vbNewLine & sourcePath
	End If
Loop
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Answers

1

Error number 80004005, when decimalised, is '5', the good old 'Access denied' error.

Answered 04/09/2013 by: VBScab
Red Belt

Please log in to comment
Answer this question or Comment on this question for clarity