Modal dialog box exception.

Compares and synchronizes SQL database content.

Moderators: Chris Auckland, David Atkinson, richardjm, david connell

Modal dialog box exception.

Postby jschwarz » Wed Nov 09, 2011 12:42 am

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?
jschwarz
 
Posts: 7
Joined: Thu Jun 16, 2011 4:24 pm

Postby Chris Auckland » Wed Nov 09, 2011 10:31 am

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
Chris Auckland
 
Posts: 757
Joined: Tue Oct 24, 2006 2:12 pm
Location: Red Gate Software Ltd.

Postby jschwarz » Mon Nov 21, 2011 4:36 pm

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...
jschwarz
 
Posts: 7
Joined: Thu Jun 16, 2011 4:24 pm

Postby Chris Auckland » Mon Nov 21, 2011 4:41 pm

ah ok, that would be:

HKEY_CURRENT_USER\\Software\\Red Gate\\SQL Tools\\SmartAssemblyReportUsage

Thanks for the update.
Chris
Chris Auckland
 
Posts: 757
Joined: Tue Oct 24, 2006 2:12 pm
Location: Red Gate Software Ltd.


Return to SQL Data Compare Previous Versions

Who is online

Users browsing this forum: No registered users and 0 guests