Click here to Skip to main content
15,921,028 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I make a crystal report and it call from the another page and use the crystal report viewer . when i click the summit button then report shows but problem arises is that the page is not navigate show the error data source is not available . but i convert its into the pdf or exel then the full report shows .
my submit button coding is that.
Try            Dim myReport As New ReportDocument
            Dim paramFields As New ParameterFields
            Dim paramField1 As New ParameterField
            Dim discreteVal1 As New ParameterDiscreteValue
            Dim logonInfo As New TableLogOnInfo
            Dim table As Table
             myReport.Load(Server.MapPath("CrystalReport.rpt"))
            For Each table In myReport.Database.Tables
                logonInfo = table.LogOnInfo
                logonInfo.ConnectionInfo.ServerName = "ABC-PC"
                logonInfo.ConnectionInfo.DatabaseName = "AgMarkDb"
                logonInfo.ConnectionInfo.UserID = "sa"
                logonInfo.ConnectionInfo.Password = "sa123"
                table.ApplyLogOnInfo(logonInfo)
            Next table
            Dim date1 As Date

            Dim dt As String
            Dim Culture As IFormatProvider

            Culture = New CultureInfo("en-GB", True)
            date1 = DateTime.Parse(TextBox1.Text.ToString, Culture, DateTimeStyles.NoCurrentDateDefault)

            paramField1.ParameterFieldName = "currentdate"
            discreteVal1.Value = date1
            paramField1.CurrentValues.Add(discreteVal1)
            paramFields.Add(paramField1)
            CrystalReportViewer1.ParameterFieldInfo = paramFields
            CrystalReportViewer1.ReportSource = myReport

            CrystalReportViewer1.Visible = True

        Catch ex As Exception
            Response.Write("DATABASE CONNECTION FAILED PLEASE TRY AFTER SOME TIMES")
            Exit Sub
        End Try
Posted
Updated 6-Jul-11 1:08am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900