Options

Modal dialog box exception.

jschwarzjschwarz Posts: 15 Bronze 2
edited November 21, 2011 10:41AM in SQL Data Compare Previous Versions
I have created a stored procedure that will call a powershell script that subsequently executes a Sql Data Compare from the command line.

The stored proc passes variables to the powershell script that generates the Data Compare Command and executes it.

This is the os command that calls the powershell script...

sqlps.exe -Command "F:\MSSQL\Powershell\scripts\DataCompareExtract.ps1 -Server1 'TSTSQL1' -Database1 'Research' -LocalSVNPath 'F:\MSSQL\Subversion\' -TableList '\[dbo\]\.\[tDataAudit\]'"

This in turn executes the following from the command line...
&"C:\Program Files (x86)\Red Gate\SQL Data Compare 9\sqldatacompare" /Server1:TSTSQL1 /database1:Research /scr2:F:\MSSQL\Subversion\Research /include:Table:\[dbo\]\.\[tDispersionMultiplierAudit\] /synchronize

Both of these commands run successfully when executed from the command line. However, when executed via the stored proc, I receive the following error stack...
Red Gate SQL Data Compare Command Line Utility V9.1.0.365

Unhandled Exception: System.InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at System.Windows.Forms.Form.ShowDialog()
at RedGate.SQLTools.SmartUsageReportingWithAdvancedUI.UsageReporterWithUI.AskUserForReportUsageConfirm()
at RedGate.SQLTools.SmartUsageReportingWithAdvancedUI.UsageReporterWithUI.ChooseWhetherToSendReport()
at RedGate.SQLTools.SmartUsageReportingWithAdvancedUI.UsageReporterWithUI.CheckAgreedToUsageReports()
at RedGate.SQLTools.SmartUsageReportingWithAdvancedUI.UsageReporterWithUI.CanReportUsage()
at #zRX.#ARX.#eI6(#8U0 )
at #zRX.#ARX.#9Lj.#bSj.#crZ()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

Does anyone have any idea why these would execute ok from the command line, but receive this error when executed via a stored proc?

Comments

  • Options
    Thanks for your post.

    I believe the dialogue box it's trying to display is the licensing client. It does this when it doesn't find the licensing information and believes the tool is unlicensed.

    I take it that SQL Data Compare Pro is activated on the SQL Server, so the problem might be that the account running the job doesn't have access to licensing information.

    Can you make sure that the account used for the job can read:
    x64: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Red Gate
    x86: HKEY_LOCAL_MACHINE\SOFTWARE\Red Gate

    C:\ProgramData\Red Gate\Licenses

    I hope this helps.
    Chris
  • Options
    jschwarzjschwarz Posts: 15 Bronze 2
    Chris, you were close... the dialogue box that it's trying to display is the box that asks if I would like to "help improve RedGate Software".

    I did check the registry, and add permissions as you suggested. I still encountered the same problem.

    In order to get this error to disappear, I had to log into the server as the service account that ends up executing the stored proc, and manually run SQL Data Compare from the command line, and click through the "help improve RedGate" pop-up. Now it will work when executed through the stored proc.

    Although I did click "No" on the "help improve RedGate" prompt, I do have a suggestion...
  • Options
    ah ok, that would be:

    HKEY_CURRENT_USER\Software\Red Gate\SQL Tools\SmartAssemblyReportUsage

    Thanks for the update.
    Chris
Sign In or Register to comment.