Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing DB Password to crystal report viewer

Status
Not open for further replies.

zqtqzq

Programmer
Jul 23, 2003
61
A2
please save a soul!

How can i pass database password to the Crystal Report Viewer.
I am using CR8.5 with VB6.0, Access2k, and need to open my report based on a passworded database
 
This is the code I used to perform it. You need to put this in the click event on your VB project. VB & Access there is no servername or db name.

You can also find this code at MS:

Code:
' Declare require variables.
Dim logOnInfo As New TableLogOnInfo()
Dim i As Integer

' Loop through every table in the report.
For i = 0 To report.Database.Tables.Count - 1
   ' Set the connection information for current table.
   logOnInfo.ConnectionInfo.ServerName = 
   logOnInfo.ConnectionInfo.DatabaseName = 
   logOnInfo.ConnectionInfo.UserID = [i]Type your DBUsername</i>
   logOnInfo.ConnectionInfo.Password = [i]Type the password[/i]
   report.Database.Tables.Item(i).ApplyLogOnInfo(logOnInfo)
Next i
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top