/build/static/layout/Breadcrumb_cap_w.png

Scripting Question


msi sql request with variable

04/08/2013 2411 views

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


All Answers

1

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

Answered 04/09/2013 by: VBScab
Red Belt

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:

Share

 
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