Results 1 to 3 of 3

Thread: Read MSI version

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2006
    Posts
    263

    Read MSI version

    I am trying to set up a ASP web page to automatically show the Current version and Date of an MSI package that I uploaded to my web site.

    The code works in VB.NET but when I try to convert it to ASP, I get an error on the OpenView. Any idea?

    Code:
    <%
      dim f, wi, fs, db, vu, fmt, full, sql
      full = Server.MapPath("./pkg.msi")
    
      set wi = Server.CreateObject("WindowsInstaller.Installer")
      set fs = Server.CreateObject("Scripting.FileSystemObject")
      sql = "SELECT * FROM property WHERE Property='ProductVersion'"
    
      if fs.FileExists(full) = True then
        set db = wi.OpenDatabase(full, 0)
        set vu = db.Openview(sql)
        vu.execute()
        Response.Write("Version=" & VU.fetch)
        vu.close()
    
        set f = fs.GetFile(full)
        dt = f.DateLastModified
        fmt = Year(dt) & "/" & right(100+Month(Dt),2) & "/" & right(100+Day(dt),2) & " " & right(100+Hour(dt),2) & ":" & right(100+Minute(dt),2) & ":" & right(100+Second(dt),2)
        Response.Write("Date=" & fmt)
      end if
    %>

  2. #2
    Addicted Member
    Join Date
    Sep 2009
    Location
    The Netherlands
    Posts
    148

    Re: Read MSI version

    hi,
    in your code stands:
    Code:
    sql = "SELECT * FROM property WHERE Property='ProductVersion'"
    I assume that ProductVersion is a variable?

    what if you try:
    Code:
    sql = "SELECT * FROM property WHERE Property=" & ProductVersion
    grtz,
    Paul

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2006
    Posts
    263

    Re: Read MSI version

    No, I have to give it the name of the Property to extract, so I can get its current value.

    This code works in VB.NET, it is just that I don't know why it fails in ASP.NET

    I am not an expert with ASP.NET, it is the first time I try it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width