HomeActive Query Builder - HowTos and TroubleshootingActive Query Builder ActiveX EditionHow to check if user cancelled the connection on login prompt?

6.2. How to check if user cancelled the connection on login prompt?

Below is the code sample in JavaScript.


// connect using Login Prompt
qb.LoginPrompt = true;
qb.ConnectionString = "your OLE DB connection string here";

try {
    qb.Connect();

    if (qb.Connected)
    {
        alert("Connected");
    }
    else
    {
        // no errors, but not connected 
        // user pressed "Cancel" in login prompt dialog
        alert("Connection is cancelled");
    }
}
catch (e)
{
    // error occured: wrong password, network error, etc.
    alert(e.message);
}

This page was: Helpful | Not Helpful