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
- :
- Add Sql script with Automation
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
Aug 14, 2008
03:46 AM
Add Sql script with Automation
I'm trying to add a couple of sql scripts with Automation objects from a little c# app. It looks something like this:
First cycle runs fine. However, I've noticed that the script.Component property has been assigned with "SQLScriptComponent" and changing the name of the script is not reflected in the component.
Second cycle of the loop it crashes at AddSQLScript() with the message:
I've tried creating a new component with a new name, assign it to the script and remove the old one (the "SQLScriptComponent") for every cycle of the loop. But the problem remains.
Any ideas?
foreach (string scriptName in sqlScripts)
{ISWiSQLConnection connection = getConnection();
ISWiSQLScript script = connection.AddSQLScript();
script.Name = scriptName;
}
First cycle runs fine. However, I've noticed that the script.Component property has been assigned with "SQLScriptComponent" and changing the name of the script is not reflected in the component.
Second cycle of the loop it crashes at AddSQLScript() with the message:
This key is already associated with an element of this collection
> ISWiAutomation.ISWiSQLScripts.Add
> ISWiAutomation.ISWiSQLConnection.AddSQLScript
I've tried creating a new component with a new name, assign it to the script and remove the old one (the "SQLScriptComponent") for every cycle of the loop. But the problem remains.
Any ideas?
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Aug 14, 2008
01:07 PM
Honestly, I haven't tried what you are attempting to do. However, as an alternative that I know works, there is a way to run SQL Scripts from Install Shield (IS) Script code by creating ADO objects. There are plenty of examples that I and other IS Developers have posted on this forum. Feel free to take a look.