Skip to main content

Connect string parameters

You can let your implementation of CreateConnectionString() return more parameters than just the Server name. In the QvEventLogConnectorElaborate example.

QvEventLogConnectorElaborate

UserId and Password are also sent as parameters to the connect string:

public override string CreateConnectionString() { QvxLog.Log(QvxLogFacility.Application, QvxLogSeverity.Debug, "CreateConnectionString()"); var login = CreateLoginWindowHelper(); login.ShowDialog(); string connectionString = null; if (login.DialogResult.Equals(true)) { connectionString = String.Format("Server={0};UserId={1};Password={2}", login.GetServer(), login.GetUsername(), login.GetPassword()); } return connectionString; }

So, how can you use the parameters? In QvEventLogConnection.cs, the VerifyCredentials() method is used and called as a safeguard before the implementation lets the invoking class access any data. In the code example a parameter is parsed from the connect string for use within the VerifyCredentials() method.

private void VerifyCredentials() { string username, password; this.MParameters.TryGetValue("UserId", out username); this.MParameters.TryGetValue("Password", out password); if (username != "InterBlag" || password != "BlagBlag") { throw new AuthenticationException("Username and/or passowrd is incorrect"); } }
Information noteThis example is in no way a guaranteed secure way to deal with user credentials and should only be regarded as a showcase of how to work with the parameters in the connect string.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!

Join the Analytics Modernization Program

Remove banner from view

Modernize without compromising your valuable QlikView apps with the Analytics Modernization Program. Click here for more information or reach out: ampquestions@qlik.com