msi sql request with variable


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
	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

0 Comments   [ + ] Show comments

Answers (1)

Posted by: anonymous_9363 9 years ago
Red Belt

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

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:


This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ