I created this sub procedure in VBScript that successfully grabs the database version from an existing installation as follows:
Code: Select all
Public Sub GetCurrentSystemVersion ()
Dim strServer
strServer = Session.Property ("SERVER_ADDRESS")
Dim strUsername
strUsername = "username"
Dim strPassword
strPassword = "password"
Dim strDatabase
strDatabase = "database"
Dim strSQL
strSQL = "SELECT system_version FROM tbl_system"
Dim strConnect
strConnect = "Provider=SQLNCLI;Server=" & strServer & ";Database=" & strDatabase & ";Uid=" & strUsername & "; Pwd=" & strPassword & ";"
Set con = CreateObject("ADODB.Connection")
Set rs = CreateObject ("ADODB.Recordset")
con.Open strConnect
rs.Open strSQL, con
Session.Property ("CURRENT_SYSTEM_VERSION") = rs.GetString ()
rs.Close
con.Close
Set rs = Nothing
Set con = Nothing
End Sub
I created a Installation Parameter called CURRENT_SYSTEM_VERSION. I need this sub procedure to be executed when the installation first fires up. As you can see, it assigns CURRENT_SYSTEM_VERSION the result of the SQL statement. I will then use that value, conditionally, to execute specific SQL scripts. How do I go about getting this to execute?