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);
}

Is this article helpful for you?