I am currently having problem displaying the Crystal Report in my VB.Net(VS2010) application. I Googled this issue, found similar problem, but their solution didn't fixed mine.
Everytime I call the CR report from my VB application, it always prompts for a Database Login. I've entered my DB credentials but it fails. I am connecting to a MySQL5.1 via ODBC connector.
In my Crystal Report, I have created a custom Command which accept 2 parameters from my application, e.i, dateFrom and dateTo, which I used to query between the date range.
I've noticed that when I took off my code where it sets the Crystal Report parameter value, the Database Login doesn't appear.
Here's my code snippet:
Dim appPath As String = Path.GetDirectoryName(Application.ExecutablePath)Dim cryRpt As New ReportDocumentDim CRTable As CrystalDecisions.CrystalReports.Engine.TableDim CRTLI As CrystalDecisions.Shared.TableLogOnInfo cryRpt.Load(appPath & "\Reports\crDtrLogs.rpt") frmReportViewer.crReportViewer.Refresh()For Each CRTable In cryRpt.Database.Tables CRTLI = CRTable.LogOnInfo With CRTLI.ConnectionInfo .ServerName = "dtrsql" .UserID = "root" .Password = "root" .DatabaseName = "dtrsql" End With CRTable.ApplyLogOnInfo(CRTLI)Next CRTable
When I took this out, everything works fine even without adding the table connection info
cryRpt.SetParameterValue("dtpFrom", dtpFrom.Value.Date.ToString("yyyy-MM-dd")) cryRpt.SetParameterValue("dtpTo", dtpTo.Value.Date.ToString("yyyy-MM-dd")) cryRpt.SetParameterValue("strDateRange", dtpFrom.Value.Date.ToString("MMMM dd, yyyy") & " - " & dtpTo.Value.Date.ToString("MMMM dd, yyyy")) frmReportViewer.crReportViewer.ReportSource = cryRpt frmReportViewer.Show()
Any help is greatly appreciated. Thanks