Hi, I'm connecting by ODBC to a secure database, when I design the report it asks for my credentials and then I can add the tables to my report and works fine.
Now I'm running that report from a VB form asking the end user for a dates range, it works fine but before running the report the end user is prompted for credentials for every table that is used in the report.
I'm trying to add the Sub PrintPreview from Chapter 17 for Logging on With the Viewer Control.
So I've got the frmPreviewForm (the one that's used at the begining of Chapter 21 for the CrystalReportViewer)
and added the Sub to it for one of my tables:
Public
Class frmPreviewForm
Inherits System.Windows.Forms.Form
Public Sub PrintPreview(ByVal UserId As String, ByVal Password As String)
Dim myReport As New CrystalReport1
Dim myLogOnInfo As CrystalDecisions.Shared.TableLogOnInfo
CrystalReportViewer1.LogOnInfo =
New CrystalDecisions.Shared.TableLogOnInfos
myLogOnInfo =
New CrystalDecisions.Shared.TableLogOnInfo
myLogOnInfo.TableName = "TRACTAMENTS"
With myLogOnInfo.ConnectionInfo
.UserID = UserId
.Password = Password
End With
CrystalReportViewer1.LogOnInfo.Add(myLogOnInfo)
myLogOnInfo.TableName = "TRACTAMENTS"
CrystalReportViewer1.ReportSource = myReport
End Sub
End
Class
But it keeps asking for this table credentials, it seems that this PrintPreview Sub shouldn't be there...