Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

API View.OpenView (or MsiDatabaseOpenView)


2 replies to this topic

pdriley

pdriley
  • Members
  • 91 posts

Posted 14 May 2002 - 18:41

If I run a piece of code through all my Merge Modules (or any other kind of MSI/ISM file) that checks for a record in a given table, but the table doesn't exist in any one database, then the program falls over.  I can't find any way of checking for the table in advance though.

For example, I'm trying to get a program (in VB) to report all Merge Modules with a Custom Action in the install sequence starting with "IS" - the only controls on my dialog are List1 and Command1:

Code Sample
Private Sub Command1_Click()
   Dim wi As Installer
   Set wi = CreateObject("WindowsInstaller.Installer")
   Dim fso As New FileSystemObject
   Dim fo As folder
   Set fo = fso.GetFolder("E:\Modules")
   Dim fi As File
   
   For Each fi In fo.Files
       Dim db As Database
       Set db = wi.OpenDatabase(fi.Path, WindowsInstaller.msiOpenDatabaseModeReadOnly)
       
       Dim vw As View
       Set vw = db.OpenView("SELECT * FROM ModuleInstallExecuteSequence")
       vw.Execute

       Dim rd As Record
       Set rd = vw.Fetch
       While Not rd Is Nothing
           If Left(rd.StringData(1), 2) = "IS" Then
               List1.AddItem (fi.Name & ": " & rd.StringData(1))
           End If
           Set rd = vw.Fetch
       Wend
       
       vw.Close
   Next
End Sub


If any one of these modules doesn't have a ModuleInstallExecuteSequence, then I get a message box saying
Run-time error '-2147467259 (80004005)'

OpenView,Sql


This obviously means "I can't run that select statement." but it's failing on the actual "Set vw = db.OpenView(...)" line, so there doesn't seem to be a way of trapping it and saying to the automation DLL "Look, if there's no table then you don't have any records, so I don't care!"

Any ideas anyone?  Please??!?
Paul Riley (Vector Networks), InstallShield User.

dbareis

dbareis
  • Full Members
  • 85 posts

Posted 15 May 2002 - 06:51

Use google groups and look for any posts (*.WSH forums)including:

"on error resume next"
---
Dennis Bareis (dbareis@No.Spam.gmail.com)
Free MSI update/creation tool (MAKEMSI):
http://users.cyberon...eis/makemsi.htm

pdriley

pdriley
  • Members
  • 91 posts

Posted 15 May 2002 - 10:14

<banging head on wall>

No need.  I know all about "On Error" and I'm going to spend the whole day kicking myself for forgetting that.  Been using .NET too much lately and "Try... Catch" is so much easier to remember :)

Thanks for the help.
Paul Riley (Vector Networks), InstallShield User.