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
- :
- Help for adapting the code for VB 2008
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 10, 2010
04:27 AM
Help for adapting the code for VB 2008
Hello All,
I need some help. We are using the VB scripts provided by Robert Dickau sometime back for modifying the script numbering in the SQL Script list. We were using vb6 and are now trying to utlise vb2008 for the same application.
I am enclosing the part of the script here below. Of course it does not work as such. With my limited VB knowledge, I could not convert it. Is there anyone using the same method for modifying data on the ISM file and if yes, would you be kind enough to share the code for VB 2008 or Express?
Thanks in advance.
Velan
Private Sub Command2_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command2.Click
Dim oRec As Object
Dim i As Object
Dim oView As Object
Dim oDB As Object
Dim oMSI As Object
oMSI = CreateObject("WindowsInstaller.Installer")
' open ISM file in transacted mode
'Set oDB = oMSI.OpenDatabase("C:\InstallShield Projects\Our_Package.ism", 1)
'UPGRADE_WARNING: Couldn't resolve default property of object oMSI.OpenDatabase. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
oDB = oMSI.OpenDatabase("Y:\Installshield Projects\Our_project.ism", 1)
' fetch the one and only samplesource record
'Set oView = oDB.OpenView("select `ISSQLScriptFile`.`InstallText`, `ISSQLConnectionScript`.`Order` from `ISSQLScriptFile`, `ISSQLConnectionScript` where `ISSQLConnectionScript`.`ISSQLScriptFile_` = `ISSQLScriptFile`.`ISSQLScriptFile` ORDER BY `ISSQLConnectionScript`.`Order`") ' = '_1.35.0780002582'")
'UPGRADE_WARNING: Couldn't resolve default property of object oDB.OpenView. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
oView = oDB.OpenView("select `ISSQLScriptFile`.`Version` from `ISSQLScriptFile`, `ISSQLConnectionScript` where `ISSQLConnectionScript`.`ISSQLScriptFile_` = `ISSQLScriptFile`.`ISSQLScriptFile` ORDER BY `ISSQLConnectionScript`.`Order`") ' = '_1.35.0780002582'")
'"Update `ISSQLSCriptFile` Set `ISSQLSCriptFile`.`ISSQLSCriptFile` = 'Processing SQL Script (out of max 250):' + Order From `ISSQLSCriptFile`, `ISSQLConnectionScript` Where `ISSQLConnectionScript`.`ISSQLSCriptFile_` = `ISSQLSCriptFile`.`ISSQLSCriptFile`")
'"update `ISSQLScriptFile` set `InstallText` = 'ISSQLScriptFile'")
'UPGRADE_WARNING: Couldn't resolve default property of object oView.Execute. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
oView.Execute()
I need some help. We are using the VB scripts provided by Robert Dickau sometime back for modifying the script numbering in the SQL Script list. We were using vb6 and are now trying to utlise vb2008 for the same application.
I am enclosing the part of the script here below. Of course it does not work as such. With my limited VB knowledge, I could not convert it. Is there anyone using the same method for modifying data on the ISM file and if yes, would you be kind enough to share the code for VB 2008 or Express?
Thanks in advance.
Velan
Private Sub Command2_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command2.Click
Dim oRec As Object
Dim i As Object
Dim oView As Object
Dim oDB As Object
Dim oMSI As Object
oMSI = CreateObject("WindowsInstaller.Installer")
' open ISM file in transacted mode
'Set oDB = oMSI.OpenDatabase("C:\InstallShield Projects\Our_Package.ism", 1)
'UPGRADE_WARNING: Couldn't resolve default property of object oMSI.OpenDatabase. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
oDB = oMSI.OpenDatabase("Y:\Installshield Projects\Our_project.ism", 1)
' fetch the one and only samplesource record
'Set oView = oDB.OpenView("select `ISSQLScriptFile`.`InstallText`, `ISSQLConnectionScript`.`Order` from `ISSQLScriptFile`, `ISSQLConnectionScript` where `ISSQLConnectionScript`.`ISSQLScriptFile_` = `ISSQLScriptFile`.`ISSQLScriptFile` ORDER BY `ISSQLConnectionScript`.`Order`") ' = '_1.35.0780002582'")
'UPGRADE_WARNING: Couldn't resolve default property of object oDB.OpenView. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
oView = oDB.OpenView("select `ISSQLScriptFile`.`Version` from `ISSQLScriptFile`, `ISSQLConnectionScript` where `ISSQLConnectionScript`.`ISSQLScriptFile_` = `ISSQLScriptFile`.`ISSQLScriptFile` ORDER BY `ISSQLConnectionScript`.`Order`") ' = '_1.35.0780002582'")
'"Update `ISSQLSCriptFile` Set `ISSQLSCriptFile`.`ISSQLSCriptFile` = 'Processing SQL Script (out of max 250):' + Order From `ISSQLSCriptFile`, `ISSQLConnectionScript` Where `ISSQLConnectionScript`.`ISSQLSCriptFile_` = `ISSQLSCriptFile`.`ISSQLSCriptFile`")
'"update `ISSQLScriptFile` set `InstallText` = 'ISSQLScriptFile'")
'UPGRADE_WARNING: Couldn't resolve default property of object oView.Execute. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
oView.Execute()
(9) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 10, 2010
05:25 PM
What exactly are you trying to do with your old VBScript? Chances are that there are better ways to accomplish the task without using the old VBScript. Please provide more detail.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 11, 2010
07:25 AM
Hi
I am trying to number the SQL scripts that we are including into the Installshield. Installshield does not do it internally and hence I am doing with an external tool.
I discussed in this forum about 5 years ago and the solution was suggested by Robert. Perhaps you are right.
http://www.installshield.com/news/newsletter/0203-articles/DEVtip.pdf
Now I need to upgrade this code into the latest VB and if you could provide any pointers, it would be really helpful.
Thanks and Best Regards,
Velan
I am trying to number the SQL scripts that we are including into the Installshield. Installshield does not do it internally and hence I am doing with an external tool.
I discussed in this forum about 5 years ago and the solution was suggested by Robert. Perhaps you are right.
http://www.installshield.com/news/newsletter/0203-articles/DEVtip.pdf
Now I need to upgrade this code into the latest VB and if you could provide any pointers, it would be really helpful.
Thanks and Best Regards,
Velan
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 11, 2010
10:52 AM
I would try looking at something like this instead of CreateObject:
Dim oMSI As Object = Activator.CreateInstance("WindowsInstaller.Installer")
How many SQL Scripts do you have and why are you numbering them? Just trying to figure out why you have an external tool to do this.
Dim oMSI As Object = Activator.CreateInstance("WindowsInstaller.Installer")
How many SQL Scripts do you have and why are you numbering them? Just trying to figure out why you have an external tool to do this.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 12, 2010
02:44 AM
Thanks for your suggestion. I will try and get back.
To explain: We have around 1500 sql scripts for each deployment. We need to number them and this number helps us to keep the track of it, for ISSCHEMA of Installshield/MS engine to ensure deploying the scripts only once during its application.
Hope this helps to understand better.
Best Regards,
Velan
To explain: We have around 1500 sql scripts for each deployment. We need to number them and this number helps us to keep the track of it, for ISSCHEMA of Installshield/MS engine to ensure deploying the scripts only once during its application.
Hope this helps to understand better.
Best Regards,
Velan
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 12, 2010
02:49 AM
Hi
I tried the dim statement but getting the following error. Do you have any idea?
Thanks
Velan
Error 1 Overload resolution failed because no accessible 'CreateInstance' can be called with these arguments:
'Public Shared Function CreateInstance(activationContext As System.ActivationContext) As System.Runtime.Remoting.ObjectHandle': Value of type 'String' cannot be converted to 'System.ActivationContext'.
'Public Shared Function CreateInstance(type As System.Type) As Object': Value of type 'String' cannot be converted to 'System.Type'. R:\Project1.NET1\frmDocument.vb 13 30 Project1
I tried the dim statement but getting the following error. Do you have any idea?
Thanks
Velan
Error 1 Overload resolution failed because no accessible 'CreateInstance' can be called with these arguments:
'Public Shared Function CreateInstance(activationContext As System.ActivationContext) As System.Runtime.Remoting.ObjectHandle': Value of type 'String' cannot be converted to 'System.ActivationContext'.
'Public Shared Function CreateInstance(type As System.Type) As Object': Value of type 'String' cannot be converted to 'System.Type'. R:\Project1.NET1\frmDocument.vb 13 30 Project1
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 13, 2010
12:32 PM
Here's something that should get you started.
First, add a reference to the Msi.dll which can found in your Windows\System32 folder. After adding it, you should see WindowsInstaller under References of your project (assumming this is a Windows Forms project).
Then, use the following code:
Let me know how that works. Of course, you'll have to use your own query but this should get you started.
Thanks,
Greg
First, add a reference to the Msi.dll which can found in your Windows\System32 folder. After adding it, you should see WindowsInstaller under References of your project (assumming this is a Windows Forms project).
Then, use the following code:
Dim oMSI As WindowsInstaller.Installer
Dim oDB As WindowsInstaller.Database
Dim oView As WindowsInstaller.View
Dim oType As Type
Try
oType = Type.GetTypeFromProgID("WindowsInstaller.Installer")
oMSI = CType(Activator.CreateInstance(oType), WindowsInstaller.Installer)
oDB = oMSI.OpenDatabase("C:\InstallShield Projects\Our_Package.ism", OpenMode.Output)
oView = oDB.OpenView("Select InstallText From ISSQLScriptFile")
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Let me know how that works. Of course, you'll have to use your own query but this should get you started.
Thanks,
Greg
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 13, 2010
10:17 PM
If you are using WindowsInstaller.Installer to update your ISM that means you are storing your project in Binary format and not XML format. That's not a very good choice in terms of fully utilizing your source control system to it's fullest ability. You do you source control and continous integration, right?
The InstallShield COM Automation Interface has the ability to manipulate sql connections and scripts. In the event it doesn't do what you want you can use an XML Dom to update the ISM or you can use the automation interface to convert the XML back to Binary format so that you can use the MSI API to update the tables directly yet still get the benefit of storing XML in source control.
I have extensive experience creating custom build automation infrastructure for these types of situations in case you'd like to have 1 on 1 assistance.
The InstallShield COM Automation Interface has the ability to manipulate sql connections and scripts. In the event it doesn't do what you want you can use an XML Dom to update the ISM or you can use the automation interface to convert the XML back to Binary format so that you can use the MSI API to update the tables directly yet still get the benefit of storing XML in source control.
I have extensive experience creating custom build automation infrastructure for these types of situations in case you'd like to have 1 on 1 assistance.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 18, 2010
10:33 AM
Hello Greg,
Thanks very much for your time and help. As I was on holidays i could not test. I will be testing this tomorrow and keep you posted.
Christopher, Thanks for your offer. I am working on the next projects and will definitely take your help.
Best Regards,
Velan
Thanks very much for your time and help. As I was on holidays i could not test. I will be testing this tomorrow and keep you posted.
Christopher, Thanks for your offer. I am working on the next projects and will definitely take your help.
Best Regards,
Velan
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 24, 2010
03:17 AM
Hello Greg
Thanks very much for your assistance and the code.
It worked like a charm.
Once again, your inputs are greatly appreciated.
Best Regards,
Velan
Thanks very much for your assistance and the code.
It worked like a charm.
Once again, your inputs are greatly appreciated.
Best Regards,
Velan
![](/skins/images/CC38E504FC9E1309DC48ACFEB4925670/responsive_peak/images/icon_anonymous_message.png)