cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SQL error ignored

Hi everyone,

I've created a Basic MSI for one of our applications. As part of the installation, the user need to browse for an MS SQL server and select a database. This works, and I can then create a configfile to setup the chosen database.

We would, however, like to check whether the database appears to be "ours", so I've created a simple SQL Script to check:

use DATABASE
select * from dbo.SSYS

The script is set to run during login, and error handling is set to "On error, abort installation". The latter is not exactly what's happening - when it works, it simply prevents the user from going any further, it does not abort the installation.

But "works" is a rather inappropriate description: In the above script, I've set a Text Replacement to replace the word DATABASE with the name of the database chosen by the user. I've also created an ordinary script to show the value in a messagebox, and the [IS_SQLSERVER_DATABASE] does hold the correct value.

Nevertheless: When running the above script, I never get any errors, no matter whether the dbo.SSYS table exist or not. If I remove the "use DATABASE" line, the script always fails (I would expect that, of course).

But why doesn't the script fail when the table doesn't exist?

I would like to show the user a proper error description, of course, but it seems that most SQL routines are available for use with InstallScript only - not Basic MSI packages. Is it at all possible to have intelligent SQL handling with Basic MSI?

Unfortunately, using InstallScript isn't an option as this app will ultimately have to pass Microsoft certification.

Regards,
Lars
Labels (1)
0 Kudos
(3) Replies
hidenori
Level 17

You can manage the behavior via the control events for the Next push button control on the SQLLogin dialog as follows:

[LIST=1]
  • Open your project in InstallShield.
  • Navigate to the Dialogs view under the User Interface section.
  • Select the Behavior node under the SQLLogin dialog.
  • Select the Next push button control in the Dialog Behavior pane.
  • Add the following entry in the Events pane:
    Event: EndDialog
    Argument: Exit
    Condition: IS_SQLSERVER_STATUS<>0 AND IS_SQLSERVER_STATUS_ERROR><"27506"
  • Rebuild your release.

    Hope that helps.
  • 0 Kudos

    Hi hidenori,

    I've tried you recommendations - but unfortunately to no avail.

    I created a dialog to show the value of the two variables in question; this dialog pops up when pressing "Next" in the SQLLogin dialog.

    The value of IS_SQLSERVER_STATUS is always 0 and the value of IS_SQLSERVER_STATUS_ERROR is always blank - no matter the result (or expected result) of the SQL script. :confused:

    Regards,
    Lars
    0 Kudos
    hidenori
    Level 17

    Would it be possbile for you to post a sample project that replicates the behavior so that I can look into it?
    0 Kudos