Report viewer is showing logon failed, pelase help me, i can able to view the data from rs1(recorset).
please help me to fix this issue, i need to pass the sql query to my pre designed Crystal report which has all the field as same as SQL query.
Please suggest me if any other alternate way to do this , my code is below.
Environment : Crystal Report 10, Visual Basic 6
cr_preview -> CrystalActiveXReportViewer
RepName -> Fiename and path of the Crystal report is designed from Crystal Report Designer.
Function show_rep(Sql As String, RepName As String) Dim crystal As CRAXDRT.Application Dim report As New CRAXDRT.report Dim rs1 As New ADODB.Recordset If rs1.State Then rs1.Close rs1.Open Sql, cn, adOpenStatic, adLockReadOnly Set crystal = New CRAXDRT.Application Set report = crystal.OpenReport(RepName) report.DiscardSavedData report.Database.SetDataSource rs1 'cr_preview.Refresh cr_preview.ReportSource = report cr_preview.Visible = True cr_preview.ViewReport Do While cr_preview.IsBusy DoEvents Loop cr_preview.Zoom 100 If rs1.State Then rs1.Close Set rs1 = Nothing Set crystal = Nothing Set report = Nothing End Function