ComponentOne VSView Reporting Edition
Build a ConnectionString with a User-supplied Password

This is a very simple alternative. Before rendering a report (or when the control reports a "failed to connect" error), you can prompt the user for a password and plug that into the connection string. For example:

Example Title
Copy Code
  ' build connection string with placeholder for password

  Dim strConn

  strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _

            "Data Source=C:\SecureData\People.mdb;" & _

            "Password={{THEPASSWORD}};"

 

  ' get password from the user

  Dim strPwd$

  strPwd = InputBox("Please enter your password:")

  If Len(strPwd) = 0 Then Exit Sub

 

  ' build new connection string and assign it to the control

  strConn = Replace(strConn, "{{THEPASSWORD}}", strPwd)

  vsr.DataSource.ConnectionString = strConn

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback