This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Query SQL database from IS
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
Not applicable
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 11, 2011
02:14 PM
Query SQL database from IS
Hello,
I got into the following problem:
A Basic MSI project with SQL scripts accessing an existing SQL Server database.
I want to update a value (table.field) in the db, but before I'd like to query it for the existing value and display it to the user.
So, from a SQL script is it possible to return a value into a IS variable?
If not (like it looks like :confused: ), is there any other solution (except sqlcmd command line)?
Thanks,
Ioan
I got into the following problem:
A Basic MSI project with SQL scripts accessing an existing SQL Server database.
I want to update a value (table.field) in the db, but before I'd like to query it for the existing value and display it to the user.
So, from a SQL script is it possible to return a value into a IS variable?
If not (like it looks like :confused: ), is there any other solution (except sqlcmd command line)?
Thanks,
Ioan
(4) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 12, 2011
09:23 AM
something like this in a vbscript CA will retrieve the UpgradeCode into the MYPROPERTY property:
Const sPC = "{ProductCode of installed software}"
Dim CachedMSI
Set oInstaller = CreateObject("WindowsInstaller.Installer")
For Each msiProduct In oInstaller.Products
If UCase(msiProduct) = sPC Then
CachedMSI = oInstaller.ProductInfo(msiProduct, "LocalPackage")
Exit For
End If
Next
Set oDB = oInstaller.OpenDatabase(CachedMSI, 1)
Set View = oDB.OpenView"SELECT `Value` FROM `Property` WHERE `Property` = 'UpgradeCode'")
View.Execute
Set Record = View.Fetch
Property("MYPROPERTY") = oRecord.StringData(1)
View.Close
Const sPC = "{ProductCode of installed software}"
Dim CachedMSI
Set oInstaller = CreateObject("WindowsInstaller.Installer")
For Each msiProduct In oInstaller.Products
If UCase(msiProduct) = sPC Then
CachedMSI = oInstaller.ProductInfo(msiProduct, "LocalPackage")
Exit For
End If
Next
Set oDB = oInstaller.OpenDatabase(CachedMSI, 1)
Set View = oDB.OpenView"SELECT `Value` FROM `Property` WHERE `Property` = 'UpgradeCode'")
View.Execute
Set Record = View.Fetch
Property("MYPROPERTY") = oRecord.StringData(1)
View.Close
Not applicable
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 12, 2011
11:37 AM
Sorry, this is not what I meant.
I'm talking about a SQL Server database.
I can create a SQL script to be run against it and do some updates, inserts, etc. But I want to retrieve a field value:
SELECT Field1 FROM aTable WHERE condition
and to pass the Field1 value to a MSI property.
I'm talking about a SQL Server database.
I can create a SQL script to be run against it and do some updates, inserts, etc. But I want to retrieve a field value:
SELECT Field1 FROM aTable WHERE condition
and to pass the Field1 value to a MSI property.
Not applicable
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 24, 2011
07:47 AM
So nobody tried to query a SQL database? :confused:
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 24, 2011
10:21 AM
i am not sure that your requirement can be addressed straight away using the SQL script view, but what you can do it use install script to create a CA that will make a connection and try to query the DB for the required vaue.